Solved

Need a VB Script

Posted on 2010-09-06
6
663 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
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 
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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
scripting, exchange 35 56
Access Control Entries lost in Windows folders 3 57
how to pick specific file from ftp 13 64
How can I save all open docs into a given folder 12 120
It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
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…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…

821 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