Back when I posted the Symantec Antivirus definition date script, I thought it would also be useful to also know the client version information. Useful – but not absolutely necessary for the task at hand. At the time, I recall poking through the registry trying to find a version stamp somewhere, but never really getting exactly what I want.
After posting the script to get a list of installed applications, I recalled my original post, and saw just how easy it was to filter the version information out of the installed applications, and combine the two scripts to print version and definition date information together. So by adding the If-Then statement inside the For Next loop, we get exactly what we need.
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 &" Rev. "& objRev
No comments:
Post a Comment