Winbatch

Print

Virus Service Start Code

As always the code presented here is for instructional purposes. These scripts will most likely need to be modified to run in your environment. Also as I believe firmly in "re-usable code" you may find pieces of your scripts incorporated into mine. If so and you would like credit use the "email me" link and let me know. I'll be happy to add your name. Likewise if you use my code in a public forum please give me credit.

NOTE: You can copy and paste the code below to a text file, just change the extension to ".wbt" so it will run in Winbatch.

About This Script:
Script to read list of systems and go to each one and make sure anti-virus was started.

Addextender("WWWNT34I.DLL")

mcf_svc1=0

loc="c:\Program Files\Network Associates\VirusScan NT\"

loc_0="\\NTSMS01\APPS\Virus Scan NT\"

v_file="scan.dat"

debug(1)

loc_1=direxist(loc)

wrkstn=Environment ("ComputerName")

If loc_1==@TRUE then

cmp=filecompare("%loc%%v_file%","%loc_0%%v_file%")

else

mail_1=1

gosub MAIL

endif

switch cmp

case 0

break

case -2

gosub UPDATE

break

case -3

gosub UPDATE

cmp=filecompare("%loc%SCAN.dat","%loc_0%%v_file%")

If cmp==-3

mail_1=2

gosub MAIL

endif

break

endswitch

:UPDATE

mcf_svc1=wntSvcStatus("","Network Associates McShield", 0, 2)

Switch mcf_svc1

case 1

break

case 2

wntSvcControl("", "Network Associates McShield", 0, 1)

break

case 3

break

case 4

wntSvcControl("", "Network Associates McShield", 0, 1)

break

case 5

break

case 6

wntSvcControl("", "Network Associates McShield", 0, 1)

break

case 7

wntSvcControl("", "Network Associates McShield", 0, 1)

break

endswitch

dat_up=Filecopy("%loc_0%%v_file%",loc,@FALSE)

If dat_up==@False

mail_1=1

gosub MAIL

endif

mcf_svc1=wntSvcStatus("","Network Associates McShield", 0, 2)

Switch mcf_svc1

case 1

wntSvcStart("", "Network Associates McShield", 0, "", "")

break

case 2

break

case 3

wntSvcStart("", "Network Associates McShield", 0, "", "")

break

case 4

break

case 5

wntSvcStart("", "Network Associates McShield", 0, "", "")

break

case 6

wntSvcStart("", "Network Associates McShield", 0, "", "")

break

case 7

wntSvcStart("", "Network Associates McShield", 0, "", "")

break

endswitch

return


:MAIL

mail_1=0

Switch mail_1

case 1

mssg="McAfee anti virus software may not be installed correclty or at all."

break

case 2

mssg="Could not update virus signature files"

break

case 3

""

break

case 4

""

break

case 5

""

break

endswitch

host="ntex01.affymetrix.com"

fromaddr=" This email address is being protected from spambots. You need JavaScript enabled to view it. "

userid="carcon"

password=""

port=""

tolist=""

cclist=""

bcclist=" This email address is being protected from spambots. You need JavaScript enabled to view it. "

subject="McAfee information about PC: %wrkstn% "

msg=mssg

attachments=""

flags=""

kInit(host,fromaddr,userid,password,port)

kDest(tolist,cclist,bcclist)

kSendText(subject,msg,attachments,flags)

msg=kStatusInfo()

Message("Message?",msg)

return