Ying Li at myITforum.com

PowerShell & System Center

VB script to get McAfee agent version, scan engine and virus defination information

Here is a VB script to read clients list from a txt file and then get McAfee agent information.

 On Error Resume Next

Const ForReading = 1
Const HKEY_LOCAL_MACHINE = &H80000002
x = 2

'Create an Excel Work Sheet

Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add

objExcel.Cells(1, 1).Value = "Machine Name"
objExcel.Cells(1, 2).Value = "Product"
objExcel.Cells(1, 3).Value = "McAfee Version"
objExcel.Cells(1, 4).Value = "McAfee Scan Engine"
objExcel.Cells(1, 5).Value = "Virus Definition"
objExcel.Cells(1, 6).Value = "Virus Definition Date"
objExcel.Cells(1, 7).Value = "Report Time Stamp"

objExcel.Range("A1:G1").Select
objExcel.Selection.Interior.ColorIndex = 19
objExcel.Selection.Font.ColorIndex = 11
objExcel.Selection.Font.Bold = True
objExcel.Cells.EntireColumn.AutoFit


'Read machine names from a txt file

Set Fso = CreateObject("Scripting.FileSystemObject")
Set InputFile = fso.OpenTextFile("MachineList.Txt")
Do While Not (InputFile.atEndOfStream)
strComputer = InputFile.ReadLine

intRow = x

objExcel.Cells(intRow, 1).Value = strComputer

GetRegInfo

objExcel.Cells(intRow, 7).Value = Now()

set strValue = Nothing
set dwValue = Nothing
set strSavVersion = Nothing
set objFSO = Nothing
Set objFile = Nothing
'Set objDatFile = Nothing
Set dtDefDate = Nothing
Set strRevNumber= Nothing

x = x + 1

Loop

Wscript.Echo "Done"

'*********************************************************************************************************
'Get information from Registry

Sub GetRegInfo

Set oReg=GetObject( _
   "winmgmts:{impersonationLevel=impersonate}!\\" &_
    strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Network Associates\TVD\VirusScan Enterprise\CurrentVersion"
strProduct = "Product"
strProductVer = "szProductVer"
strEngineVer = "szEngineVer"
strVirDefVer  = "szVirDefVer"
strVirDefDate = "szVirDefDate"

oReg.GetStringValue _
   HKEY_LOCAL_MACHINE,strKeyPath,strProduct,strValue1

objExcel.Cells(intRow, 2).Value = strValue1

oReg.GetStringValue _
   HKEY_LOCAL_MACHINE,strKeyPath,strProductVer,strValue2

objExcel.Cells(intRow, 3).Value = strValue2

oReg.GetStringValue _
   HKEY_LOCAL_MACHINE,strKeyPath,strEngineVer,strValue3

objExcel.Cells(intRow, 4).Value = strValue3

oReg.GetStringValue _
   HKEY_LOCAL_MACHINE,strKeyPath,strVirDefVer,strValue4

objExcel.Cells(intRow, 5).Value = strValue4

oReg.GetStringValue _
   HKEY_LOCAL_MACHINE,strKeyPath,strVirDefDate,strValue5

objExcel.Cells(intRow, 6).Value = strValue5


End Sub

Posted: Feb 06 2007, 01:22 PM by yli628 | with no comments
Filed under:

Comments

No Comments