This is my VBS script to automatically download, install and run a spybot scan.
IT, checks to see if c:spybotspybotsd.exe exists, if not, it then downloads it from the URL
Then updates and scans.
If it does exist, then it updates and scans.
sTarget = “C:temp”
Set objFSO = CreateObject(“Scripting.FileSystemObject”)
If Not objFSO.FolderExists(sTarget) Then
objFSO.CreateFolder(“c:temp”)
End IfWscript.Echo “Starting”
strFileURL = “http://www.spybotupdates.com/files/spybotsd162.exe”
strHDLocation = “c:tempspybotsd162.exe”If objFSO.Fileexists(“c:spybotspybotsd.exe”) Then
Set WshShell = WScript.CreateObject(“WScript.Shell”)
‘ update
Wscript.Echo “Updating”
Return = WshShell.Run(“c:spybotspybotsd.exe /autoupdate /taskbarhide /autoimmunize /autoclose “, 0, true)‘ Run scan
Wscript.Echo “Scanning”
Return = WshShell.Run(“c:spybotspybotsd.exe /autocheck /autofix /autoclose /taskbarhide “, 0, true)Wscript.Echo “Complete”
Else Set objXMLHTTP = CreateObject(“MSXML2.XMLHTTP”)
objXMLHTTP.open “GET”, strFileURL, false
objXMLHTTP.send()If objXMLHTTP.Status = 200 Then
Wscript.Echo “Downloading the latest version of Spybot…” & VbCrLf & VbCrLf
Set objADOStream = CreateObject(“ADODB.Stream”)
objADOStream.Open
objADOStream.Type = 1 ‘adTypeBinaryobjADOStream.Write objXMLHTTP.ResponseBody
objADOStream.Position = 0Set objFSO = Createobject(“Scripting.FileSystemObject”)
If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile strHDLocation
Set objFSO = NothingobjADOStream.SaveToFile strHDLocation
objADOStream.Close
Wscript.Echo “Download complete” & VbCrLf & VbCrLf
Set objADOStream = Nothing
End if‘ Install Spybot from c:tempspybotsd162.exe
Set WshShell = WScript.CreateObject(“WScript.Shell”)
Return = WshShell.Run(“c:tempspybotsd162.exe /silent /norestart /dir=c:spybot “, 0, true)‘ update
Wscript.Echo “Updating”
Return = WshShell.Run(“c:spybotspybotsd.exe /autoupdate /taskbarhide /autoimmunize /autoclose “, 0, true)‘ Run scan
Wscript.Echo “Scanning”
Return = WshShell.Run(“c:spybotspybotsd.exe /autocheck /autofix /autoclose /taskbarhide “, 0, true)Wscript.Echo “Complete”
End if
I Just now need a way to get the logs back from the client machines into the GFIMax console.
I have had this running on W7, XP, Vista, Server 2003 and Server 2008 machiens.
Hi, I’m looking at your script to install program’s remotely on managed nodes via GFI Max. The problem we are facing is when the download takes more than 60 seconds (which is the maximum runtime of a script with GFI Max). Do you perhaps have a solution for that?
Regards!
Bastiaan
Hi,
You can change the time out. I have a script that downloads a 800MB file. Timeout is 3 hours. It works fine.
Did you ever figure out how to return a log to GFI? I’ve been meaning to script a download/install/scan of MBAM – your VB will probably be helpful! Thanks!
Microsoft security essentials considers this script a virus threat
Lots of AV products do.
The reason is because from a single click it downloads then runs something. If it were a virus, it would be a single click install.
The solution we use it to exclude the scripts folders on local PCs. This allows all the good things to happen while keeping all the bad stuff away.
Running the vbs script returns an output on GFI of ” Invalid Script Arguments “. Am I missing something?