Solved

Need a VB Script

Posted on 2010-09-06
6
659 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 5

Author Comment

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

Expert Comment

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

Author Closing Comment

by:sujithmd
Comment Utility
Thanks for the assist
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now