CODE
;Install program and update (Should be in same directory as script and named as used below)
RunWait(@ScriptDir & '\spybotsd152.exe /verysilent /components="" /tasks="" /norestart')
RunWait(@ScriptDir & '\spybotsd_includes.exe /S')
;Configure spybot to not show the wizard, legal notice, or update reminder
RegWrite('HKEY_CURRENT_USER\Software\Safer Networking Limited\SpybotSnD', 'WizardRun', 'REG_DWORD', 1)
IniWrite(@AppDataCommonDir & '\Spybot - Search & Destroy\Configuration.ini','Main', 'Legals', 1)
IniWrite(@AppDataCommonDir & '\Spybot - Search & Destroy\Configuration.ini', 'Automation\WebUpdate','RemindUpdate', 0)
;Setup a scheduled task
$adminUsername = 'Administrator'
$adminPassword = 'password'
If _isLaptop() Then
$scanTime = '16:00:00';HH:MM:SS
Else
$scanTime = '04:00:00';HH:MM:SS
EndIf
Run(@ComSpec & " /c " & 'schtasks /create /tn "Spybot Daily Scan" /tr "' & FileGetShortName(@ProgramFilesDir & '\Spybot - Search & Destroy\SpybotSD.exe') & ' /AUTOCHECK /AUTOFIX /AUTOCLOSE" /sc daily /st ' & $scanTime & ' /ru ' & @ComputerName & '\' & $adminUsername &' /rp ' & $adminPassword)
;If there is an internet connection autoupdate and immunize, otherwise just immunize
If Ping('www.google.com') Then
Run(@ProgramFilesDir & '\Spybot - Search & Destroy\SpybotSD.exe /autoimmunize /autoupdate /autoclose')
TrayTip('Updating Definitions', 'Please while the latest Spybot definitions are downloaded', 10)
If WinWait('Information', 'OK',120) Then
ControlClick('Information', 'OK','TButton1')
WinWait('Spybot - Search & Destroy', '&Check for problems')
WinClose('Spybot - Search & Destroy', '&Check for problems')
EndIf
Else
Run(@ProgramFilesDir & '\Spybot - Search & Destroy\SpybotSD.exe /autoimmunize /autoclose')
TrayTip('Error Downloading Updates', 'It appears you are not connected to the internet, skipping detection updates...',5)
Sleep(5000)
EndIf
Func _isLaptop()
$objWMIService = ObjGet("winmgmts:\\" & @ComputerName & "\root\cimv2")
$colChassis = $objWMIService.ExecQuery("Select * from Win32_SystemEnclosure")
For $objChassis In $colChassis
For $ChassisType In $objChassis.ChassisTypes
Switch $ChassisType
Case 8 to 14
Return True
Case Else
Return False
EndSwitch
Next
Next
EndFunc
RunWait(@ScriptDir & '\spybotsd152.exe /verysilent /components="" /tasks="" /norestart')
RunWait(@ScriptDir & '\spybotsd_includes.exe /S')
;Configure spybot to not show the wizard, legal notice, or update reminder
RegWrite('HKEY_CURRENT_USER\Software\Safer Networking Limited\SpybotSnD', 'WizardRun', 'REG_DWORD', 1)
IniWrite(@AppDataCommonDir & '\Spybot - Search & Destroy\Configuration.ini','Main', 'Legals', 1)
IniWrite(@AppDataCommonDir & '\Spybot - Search & Destroy\Configuration.ini', 'Automation\WebUpdate','RemindUpdate', 0)
;Setup a scheduled task
$adminUsername = 'Administrator'
$adminPassword = 'password'
If _isLaptop() Then
$scanTime = '16:00:00';HH:MM:SS
Else
$scanTime = '04:00:00';HH:MM:SS
EndIf
Run(@ComSpec & " /c " & 'schtasks /create /tn "Spybot Daily Scan" /tr "' & FileGetShortName(@ProgramFilesDir & '\Spybot - Search & Destroy\SpybotSD.exe') & ' /AUTOCHECK /AUTOFIX /AUTOCLOSE" /sc daily /st ' & $scanTime & ' /ru ' & @ComputerName & '\' & $adminUsername &' /rp ' & $adminPassword)
;If there is an internet connection autoupdate and immunize, otherwise just immunize
If Ping('www.google.com') Then
Run(@ProgramFilesDir & '\Spybot - Search & Destroy\SpybotSD.exe /autoimmunize /autoupdate /autoclose')
TrayTip('Updating Definitions', 'Please while the latest Spybot definitions are downloaded', 10)
If WinWait('Information', 'OK',120) Then
ControlClick('Information', 'OK','TButton1')
WinWait('Spybot - Search & Destroy', '&Check for problems')
WinClose('Spybot - Search & Destroy', '&Check for problems')
EndIf
Else
Run(@ProgramFilesDir & '\Spybot - Search & Destroy\SpybotSD.exe /autoimmunize /autoclose')
TrayTip('Error Downloading Updates', 'It appears you are not connected to the internet, skipping detection updates...',5)
Sleep(5000)
EndIf
Func _isLaptop()
$objWMIService = ObjGet("winmgmts:\\" & @ComputerName & "\root\cimv2")
$colChassis = $objWMIService.ExecQuery("Select * from Win32_SystemEnclosure")
For $objChassis In $colChassis
For $ChassisType In $objChassis.ChassisTypes
Switch $ChassisType
Case 8 to 14
Return True
Case Else
Return False
EndSwitch
Next
Next
EndFunc
