Solved

Need a VB Script

Posted on 2010-09-06
6
673 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
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…

622 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