[LONG LINES Broken by NTDOC]
I know this is an old post but I spent some time trying to clean up this code
as I have an interest in this topic. Since I am relatively new to KiXtart I
probably butchered the code, but just need to see if I am on the right track.
I don't know how to create an array yet so I left out that part. I have
implemented a similar script, though not as robust as Scriptdude's approach,
also with goto's
Below is what I came up with. Is gooood or is baaad?
Code:
:start
$nul = ""
$PCNAME = @WKSTA
$NTEventSource = "KiXtart"
$SpybotExists = EXIST("C:\Program Files\Spybot - Search & Destroy\spybotsd.exe")
$SpybotVer = GetFileVersion("C:\Program Files\Spybot - Search & Destroy\spybotsd.exe",
"FileVersion")
Select
Case 1
IF $SpybotExists = 1
IF $SpybotVer >= "1, 3, 0, 12"
IF EXIST("%ALLUSERSPROFILE%\Application Data\Spybot - Search & Destroy\
logs\fixe*.txt")
MOVE "%ALLUSERSPROFILE%\Application Data\Spybot - Search & Destroy
\logs\fixe*.txt" "%ALLUSERSPROFILE%\Application Data\Spybot -
Search & Destroy\logs\fixe*.old"
MD "%ALLUSERSPROFILE%\Application Data\Spybot - Search & Destroy\logs"
COPY "\\\Spybot\SPYBOT\Excludes\*.*" "%ALLUSERSPROFILE%\
Application Data\Spybot - Search & Destroy\Excludes" /c /h /r /s
;$mbox = Messagebox (" !!!!!
WEEKLY SPYWARE SCAN NOTIFICATION!!!!!
;
; - Spybot will begin scanning for known spyware
;and adware in 10 minutes.
; - Click the OK button to start the scan immediately.
; - There is no need to reboot after the scan.
; - If you have any issues or concerns please contact the.
; - We apologize for any inconvenience this may cause.
;
; Thank You,
; , "WEEKLY SPYBOT SCAN!!!!", 4096, 600)
SHELL "C:\Program Files\Spybot - Search & Destroy\spybotsd.exe
/taskbarhide /autoupdate /autoclose"
;-----------------------------------------------------------------
;--------------------------------------------------------------------
;this section would normally contain code to kill spyware processes
;--------------------------------------------------------------
;-----------------------------------------------------------------------
SHELL "C:\Program Files\Spybot - Search & Destroy\spybotsd.exe
/taskbarhide /autocheck /autofix /autoclose"
;Below I remove the value to run Spybot at next reboot one time
;because most of the users in the domain do not ;have local admin priv.
$RunOnce = DelValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\
Windows\CurrentVersion\RunOnce", "SpybotSnD")
goto "VerifyFix"
;Verify that Spybot actually fixed the Spyware that was found on
;the local computer. If so log an event to the ;Application log.
$Filename = Dir("%AllUSERSPROFILE%\Application Data\
Spybot - Search & Destroy\logs\Fixes*.txt")
COPY "%AllUSERSPROFILE%\Application Data\
Spybot - Search & Destroy\logs\$Filename" "\\\spybot13\
Weekly\@WKSTA_@YDAYNO.log"
LOGEVENT( 4 , 1001 , "Spybot has scanned and removed spyware
on this computer!" , "$PCNAME", "$NTEventSource")
OPEN (1, "\\\Spybot13\Spybotscan.log", 5)
WRITELINE (1, @DATE + " " + @TIME + " Spybot has scanned and
fixed spyware on " + $PCNAME + chr(13) + chr(10))
else
OPEN (1, "\\\Spybot13\Spybotnofix.log", 5)
WRITELINE (1, @DATE + " " + @TIME + " Spybot scanned and
did not find any problems on " + $PCNAME + chr(13) + chr(10))
ENDIF
else
OPEN (1, "\\\Spybot13\Spybotv13notinst.log", 5)
WRITELINE (1, @DATE + " " + @TIME + " An older version of
Spybot is installed on " + $PCNAME + chr(13) + chr(10))
ENDIF
Endif
Case 2
OPEN (1, "\\\Spybot13\Spybotnotinstalled.log", 5)
WRITELINE (1, @DATE + " " + @TIME + " Spybot is not installed
on " + $PCNAME + chr(13) + chr(10))
ENDSELECT