Solved

Need a VB Script

Posted on 2010-09-06
6
662 Views
Last Modified: 2012-06-21
I need a VB script that will pull details of Symantec AV Corporate edition  from a list of servers

Details required are : Client Version,Antivirus Definition date or version and the server name which it runs.
0
Comment
Question by:sujithmd
  • 3
  • 3
6 Comments
 
LVL 42

Expert Comment

by:sedgwick
ID: 33618026
this script should check Symantec Antivirus version information and definition dates
(http://addicted-to-it.blogspot.com/2006/02/wmi-checking-symantec-antivirus.html)
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Product")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Wscript.Shell")
strCmdRun = "cmd /c"
strRegQ = "reg query "
strRegKey = "\HKLM\SOFTWARE\Symantec\SharedDefs\"
strCmdSw = " /v "
strRegKey2 = "DEFWATCH_10"
Dim objShell,objDef,objDate,objVer,objRev,objOutFile,objFSO,objNDate

Set objExec = objShell.Exec(strCmdRun & strRegQ & "\\" & strcomputer & strRegKey & strCmdSw & strRegKey2)

strExecResults = LCase(objExec.StdOut.ReadAll)
objVer = Right(strExecResults,16)
objRev = Right(objVer,7)
objDate = Left(objVer,8)
objYear = Left(objDate,4)
objMonth = Mid(objDate,5,2)
objDay = Right(objDate,2)
objNDate = CDATE(objMonth &"/"& objDay &"/"& objYear)


For Each objItem in colItems
 If objItem.Description = "Symantec AntiVirus" Then
   wscript.echo objItem.Description &  " (v." & objItem.Version & ")"
 End if
Next

wscript.echo vbCrLf &"Symantec AntiVirus definition date: " & objNDate

Open in new window

0
 
LVL 5

Author Comment

by:sujithmd
ID: 33738000
hi any idea how can i get the AV details from a list of servers say i keep the server names in a txt file or so and i can get info of all those servers.
0
 
LVL 42

Accepted Solution

by:
sedgwick earned 500 total points
ID: 33748624
try this script
const MACHINES_LIST_FILE = "c:\temp\machines.txt"
set objFile = objFSO.OpenTextFile(MACHINES_LIST_FILE, 1)
arrMachines = Split(objFile.ReadAll, vbNewLine)
objFile.Close


for each strComputer in arrMachines
	if Trim(strComputer) <> "" then
		ProcessServerDeails strComputer
	end if
Next

sub ProcessServerDeails(strComputer)

	Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
	Set colItems = objWMIService.ExecQuery("Select * from Win32_Product")
	Set objFSO = CreateObject("Scripting.FileSystemObject")
	Set objShell = CreateObject("Wscript.Shell")
	strCmdRun = "cmd /c"
	strRegQ = "reg query "
	strRegKey = "\HKLM\SOFTWARE\Symantec\SharedDefs\"
	strCmdSw = " /v "
	strRegKey2 = "DEFWATCH_10"
	Dim objShell,objDef,objDate,objVer,objRev,objOutFile,objFSO,objNDate

	Set objExec = objShell.Exec(strCmdRun & strRegQ & "\\" & strcomputer & strRegKey & strCmdSw & strRegKey2)

	strExecResults = LCase(objExec.StdOut.ReadAll)
	objVer = Right(strExecResults,16)
	objRev = Right(objVer,7)
	objDate = Left(objVer,8)
	objYear = Left(objDate,4)
	objMonth = Mid(objDate,5,2)
	objDay = Right(objDate,2)
	objNDate = CDATE(objMonth &"/"&amp; objDay &"/"& objYear)


	For Each objItem in colItems
	 If objItem.Description = "Symantec AntiVirus" Then
	   wscript.echo objItem.Description &  " (v." & objItem.Version & ")"
	 End if
	Next

	wscript.echo vbCrLf &"Symantec AntiVirus definition date: " & objNDate
end sub

Open in new window

0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 5

Author Comment

by:sujithmd
ID: 33760117
Getting error
Line : 35
Char : 36
Error : Expected ')'
0
 
LVL 42

Expert Comment

by:sedgwick
ID: 33761839
replace line 35 with this line:
      objNDate = CDATE(objMonth &"/"& objDay &"/"& objYear)
0
 
LVL 5

Author Closing Comment

by:sujithmd
ID: 34237607
Thanks for the assist
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you get a (Blue Screen of Death), your system writes a small file called a minidump. Your first step is to make certain your computer is setup to record memory dumps. Right click My Computer, choose properties. Click on the advanced tab, an…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question