Wednesday, September 30, 2015

AutoIT Sample scripts- for SCCM Packaging


AutoIT Sample scripts 


//Hide tray Icon

Opt("TrayIconHide", 1)

// Add Registry Value

RegWrite("HKEY_CURRENT_USER\Software\Microsoft\ABC", "abc", "REG_DWORD", "0")

// For Sleep/Wait/Pause time

Sleep(60000)

// Running a program .msi or .exe with switches

RunWait("msiexec /i abc.msi ALLUSERS=1 /qn /norestart")

// For registry file or .exe/.msi

ShellExecuteWait("Regedit.exe", "/s abc.reg", "", "", @SW_HIDE)


Sample Script

Opt("TrayIconHide", 1)
RunWait("msiexec /i abc.msi ALLUSERS=1 /qn /norestart")
Sleep(60000)
ShellExecuteWait("Regedit.exe", "/s abc.reg", "", "", @SW_HIDE)
RunWait("abc.bat")
Exit


More Details about AutoIT - https://www.autoitscript.com/site/autoit/

Friday, September 25, 2015

Packaging Enterprise version(x86 & x64) Google Chrome with AutoIT

Packaging Enterprise version Google Chrome with AutoIT

Download Latest version on Chrome Emterprise version.

Create a directory and copy files and create an application in SCCM 2012

1. Chrome msi
2. Install.cmd
3.master_preferences

Please downloaded the file and instaruction from here

install.cmd

msiexec /qn /norestart /i "%~dp0chromeEnterprise44.0.2403.107_x64.msi"
if exist "c:\Program Files\Google\Chrome\Application\master_preferences" copy /y "%~dp0master_preferences" "C:\Program Files\Google\Chrome\Application\master_preferences"
if exist "c:\Program Files (x86)\Google\Chrome\Application\master_preferences" copy /y "%~dp0master_preferences" "C:\Program Files (x86)\Google\Chrome\Application\master_preferences"
reg add HKLM\Software\Policies\Google\Update /f /v AutoUpdateCheckPeriodMinutes /d 0
sc stop gupdate
sc config gupdate start= disabled
sc stop gupdatem
sc config gupdatem start= disabled
del "C:\Program Files\Google\Update\GoogleUpdate.exe"
rmdir /s /q "C:\Program Files\Google\Update"
REM Return exit code to SCCM
exit /B %EXIT_CODE%


Sample master_preferences

"homepage" : "http://msiworld.blogspot.com", 
"homepage_is_newtabpage" : false, 
"browser" : { 
"show_home_button" : true,
 "check_default_browser" : false,
 "window_placement": {
 "bottom": 1000,
 "left": 10,
 "maximized": false,
 "right": 904,
 "top": 10,
 "work_area_bottom": 1010,
 "work_area_left": 0,
 "work_area_right": 1680,
 "work_area_top": 0
 }
 },
 "bookmark_bar" : { 
"show_on_all_tabs" : true 
}, 
"distribution" : { 
"skip_first_run_ui" : true, 
"show_welcome_page" : false, 
"import_search_engine" : false, 
"import_history" : false, 
"create_all_shortcuts" : true, 
"do_not_launch_chrome" : true, 
"make_chrome_default" : false 
}
}

Edit the chrome msi file name as appropriate in .bat. This should also disable auto update but i had issues with disabling auto update using batch so i have created an AutoIT script to make it work every single time it runs- SCCM 2012 R2.

Details about AutoIT


Create a AutoIT Script and compile it. Create an Application in SCCM 2012 using Script and deploy it.

Opt("TrayIconHide", 1)
RunWait( "install.cmd")
RunWait(@ComSpec & " /c " & "taskkill /f /im GoogleUpdate.exe ", "", @SW_HIDE)
$svccfg = "sc config gupdate start= disabled"
RunWait(@ComSpec & " /C " & $svccfg, "", @SW_HIDE)
$svccfg = "sc config gupdatem start= disabled"
RunWait(@ComSpec & " /C " & $svccfg, "", @SW_HIDE)
FileDelete("C:\Program Files\Google\Update\GoogleUpdate.exe")
FileDelete("C:\Program Files\Google\Update\GoogleUpdate.exe")
Exit

Create a packages for x86 & x64 bit. Create an application in SCCM 2012 and choose deployment Type option. Create a Global condition based on Architecture type for X86 & x64 and select Global condition requirement.

When application will be deployed , it will check if the OS is 64 bit, then 64 bit Google chrome will be installed on the system and accordingly for x86.






SCCM 2012 Dynamic collection for Specific System Model - Lenovo Laptops

SCCM 2012 Dynamic collection for Specific System Model - Lenovo Laptops

If you need to create a collection for specic System model for Lenovo Laptops. Please use below query and change Model accordingly.


select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_COMPUTER_SYSTEM_PRODUCT on SMS_G_System_COMPUTER_SYSTEM_PRODUCT.ResourceId = SMS_R_System.ResourceId where SMS_G_System_COMPUTER_SYSTEM_PRODUCT.Version = "ThinkPad x240"