Jump to content

Spybot for Dummies


Klaatu
 Share

Recommended Posts

I came up with this when the President of the company asked for an easy way to help get rid of spyware from his home PC.

It will install (silently) and run (silently) Spybot S&D if not already installed, or just run it (silently) if its already installed.

All that's needed is to download Spybot's install file to where the script is and compile it. Then give the resulting .exe to the boss.

Global Const $ProgramName = 'Spybot - Search & Destroy' 
Global $Program = @ProgramFilesDir & '\' & $ProgramName & '\' & 'SpybotSD.exe' 
Main()
Exit

Func Main()
    If Not @Compiled Then
        Opt ("TrayIconDebug", 1)
    EndIf
    If Not FileExists($Program) Then
        InstallSpybot()
    EndIf
    RunSpybot()
EndFunc  ;==>Main

Func InstallSpybot()
    Local $TempInstall = TempFile('.exe')
    Local $DesktopIcon = @DesktopDir & '\' & $ProgramName & '.lnk' 
    
    TrayTip(@ScriptName, 'Installing ' & $ProgramName, 1)
    FileInstall("spybotsd13.exe", $TempInstall)
    RunWait(Quote($TempInstall) & ' /verysilent /nocancel /components="main"')
    Sleep(2000)
    FileDelete($TempInstall)
    If FileExists($DesktopIcon) Then
        FileDelete($DesktopIcon)
    EndIf
    RunSilent()
    TrayTip(@ScriptName, 'Done installing ' & $ProgramName, 1)
    Sleep(2000)
EndFunc  ;==>InstallSpybot

Func RunSpybot()
    TrayTip(@ScriptName, 'Running ' & $ProgramName, 1)
    RunSilent()
    TrayTip(@ScriptName, 'Done running ' & $ProgramName, 1)
    Sleep(3000)
EndFunc  ;==>RunSpybot

Func RunSilent()
    RunWait(Quote($Program) & ' /autoupdate /autocheck /autofix /autoclose /autoimmunize /taskbarhide')
EndFunc  ;==>RunSilent

Func TempFile($Ext = 'tmp')
    Local $TempName
    If StringLeft($Ext, 1) <> '.'  Then
        $Ext = '.' & $Ext
    EndIf
    Do
        $TempName = "~" 
        While StringLen($TempName) < 8
            $TempName = $TempName & Chr(Round(Random(97, 122), 0))
        Wend
        $TempName = @TempDir & "\" & $TempName & $Ext
    Until Not FileExists($TempName)
    Return ($TempName)
EndFunc  ;==>TempFile

Func Quote($TheString, $QuoteChar = '"')
    Return ($QuoteChar & $TheString & $QuoteChar)
EndFunc  ;==>Quote
My Projects:DebugIt - Debug your AutoIt scripts with DebugIt!
Link to comment
Share on other sites

You could probably read the path from the registry.

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

wat about if they installed spybot in a different folder eg.

c:\spybot\

?

<{POST_SNAPBACK}>

Then Spybot would get installed again, into the default folder, presumably. But the boss does not have Spybot installed already, so no worries.
My Projects:DebugIt - Debug your AutoIt scripts with DebugIt!
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...