Share This Post

VB script to get McAfee agent version, scan engine and virus definition 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

Share This Post

Ying Li obtained a Master degree of Medicine in China and worked in the medical field before he came to the states in 1996. He made the career switch from troubleshooting people to troubleshooting computers after he came to the states. Not entirely a surprise there, if you know that his second preference for college is Mathematics. Ying is two times Admin Framework MVP awardee (2007-2008).His previous employment experience in the US includes UUNET, MCI WorldCom. MMC (Marsh & McLennan Companies), Merrill Lynch. He is currently employed by Related Companies as a Senior Infrastructure Engineer. He is proficient in virtually all Microsoft products (Office/Back office). His craving for efficiency naturally leads him to scripting, automation and before you know it, PowerShell! He is currently a MCSE (NT4, 2000, 2003) and MCITP Server Administrator. Ying enjoys wines and love to travel. His non work related passion is to advocate Health Living!

Leave a Reply