Solved

Need a VB Script

Posted on 2010-09-06
6
666 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
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 
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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
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 while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

751 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