Option Explicit
'Script to be used with BBNT to check Symantec Corp Ed virus definition version
'Jeff Ehrenberg jeff @ uscomputerconnection.com
'
'Script to be used with BBWin to check Mcafee Antivirus definition version, Symantec pillet ud af.
' SAV output file ændret til sigav
'Tilrettet af Kenneth S. Petersen Nov. 2011
'
'
' Modified 16/08/06 to work with Austrailian date format Graeme Shea Graeme@shea.com.au
' Modified 18/08/06 to work to allow for using liveupdate. Live update stores
' now allows for 64 bit machines.
' virus def information in different key. Graeme Shea Graeme@shea.com.au
' 0.9. Added debug logging and version no. Graeme Shea 06/09/06
' 1.0 Added search for BBWin path and current time to output file. Graeme Shea 17/12/07
Const Version = "1.0"
Const bCreateLog = false 'If true adds debugging info to output file.
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Dim oShell,oDef,oDef2,oDate,oDate2,oVer,oVer2,oRev,oOutFile,oFSO
Dim oNDate,oToday,oYear,oMonth, oDay, oHour2, oMinute2, oSecond2, oDateDiff, oRev2, oYear2, oMonth2, oDay2, oNDate2, b64Bit, szLog, ExtPath
Set oFSO= CreateObject("Scripting.FileSystemObject")
Set oShell = WScript.CreateObject("WScript.Shell")
If bCreateLog Then WriteLog("Debug logging enabled. ")
' Find path for extenal files
On Error Resume Next
ExtPath = oShell.RegRead("HKLM\SOFTWARE\bbwin\ExtPath\")
If IsEmpty(ExtPath) Then
ExtPath = oShell.RegRead("HKLM\SOFTWARE\BBWin\tmppath")
End If
If Not IsEmpty (ExtPath) Then 'If not empty then we have 32bit machine
b64Bit = False
End If
If IsEmpty(ExtPath) Then
ExtPath = oShell.RegRead("HKLM\SOFTWARE\Wow6432node\bbwin\ExtPath\")
End If
If IsEmpty(ExtPath) Then
ExtPath = oShell.RegRead("HKLM\SOFTWARE\Wow6432node\BBWin\tmppath")
End If
If Not IsEmpty(ExtPath) And isEmpty(b64Bit) Then
b64Bit = True
err.clear
If bCreateLog Then WriteLog("64bit System Detected. ")
End If
If Not IsEmpty(ExtPath) Then
If bCreateLog Then WriteLog("Got External Path as " & ExtPath)
Else
Call WriteLog("Fatal Error External Path Not Found!")
End If
on Error GoTo 0
Set oOutFile = oFSO.CreateTextFile (ExtPath & "\sigav")
If bCreateLog Then WriteLog("Created Output file " & ExtPath & "\sigav")
oToday = FormatDateTime(Now, vbShortDate)
'Check Virus Def Date by reading value from registry
If bCreateLog Then WriteLog("Got todays date as " & oToday)
if not b64Bit then
oDef = oShell.RegRead ("HKLM\SOFTWARE\McAfee\AVEngine\AVDatDate")
Else
oDef = oShell.RegRead ("HKLM\SOFTWARE\Wow6432Node\McAfee\AVEngine\AVDatDate")
end If
If bCreateLog Then WriteLog("Got McAfee Auto update Def date as " & oDef)
oVer = Right(oDef,12)
oRev = Right(oVer,3)
oDate = Left(oVer,8)
oYear = Left(oDate,4)
oMonth = Mid(oDate,5,2)
oDay = Right(oDate,2)
'oNDate = CDATE(oMonth &"/"& oDay &"/"& oYear) 'American Date format
'oNDate = CDATE(oDay &"/"& oMonth &"/"& oYear) 'Australian Date Format
[b]It this line that fails[/b]
oNDate = CDATE(oYear &"/"& oMonth &"/"& oDay) 'Mcafee Date format
'Determine age of virus definitions, if more then 7 days old display yellow on BB
If bCreateLog Then WriteLog("Converted McAfee Auto Update Def to " & oNDate)
oDateDiff = DateDiff("d", oNDate, oToday)
If bCreateLog Then WriteLog("Got Date Difference as " & oDateDiff)
' If you do a live update def date is stored if diff key so also try other key.
if not b64Bit then
oDef2 = oShell.RegRead ("HKLM\SOFTWARE\Network Associates\ePolicy Orchestrator\Application Plugins\VIRUSCAN8600\DatDate")
Else
oDef2 = oShell.RegRead ("HKLM\SOFTWARE\Wow6432Node\Network Associates\ePolicy Orchestrator\Application Plugins\VIRUSCAN8600\DatDate")
end if
If bCreateLog Then WriteLog("Got McAfee Auto update Def date as " & oDef2)
oVer2 = Right(oDef2,12)
oRev2 = Right(oVer2,3)
oDate2 = Left(oVer2,8)
oDay2 = Left(oDate2,2)
oMonth2 = Mid(oDate2,5,2)
oYear2 = Right(oDate2,4)
'oNDate2 = CDATE(oMonth2 &"/"& oDay2 &"/"& oYear2) 'American Date format
'oNDate2 = CDATE(oDay2 &"/"& oMonth2 &"/"& oYear2) 'Austrailan Date Format
oNDate2 = CDATE(oYear &"/"& oMonth &"/"& oDay) 'Mcafee Date format
If bCreateLog Then WriteLog("Converted McAfee Auto Update Def to " & oNDate2)
If bCreateLog Then WriteLog("Got Date Difference as " & DateDiff("d", oNDate2, oToday))
' find which def date is newer and write results to Big Brother file.
if oDateDiff>DateDiff("d", oNDate2, oToday) Then
If bCreateLog Then WriteLog("Using McAfee Auto udate Def date. ")
oDateDiff = DateDiff("d", oNDate2, oToday)
'If (oDateDiff > 8) Then = High nr. equal High count of days.
If (oDateDiff > 8) Then
oOutFile.WriteLine "yellow+12h Test run at " & Now
Else oOutFile.WriteLine "green+12h Test run at " & Now
End If
oOutFile.WriteLine vbCrLf &"Found McAfee Enterprise Anti Virus definition file version:"
oOutFile.WriteLine oNDate2 &" Rev. "& oRev2
oOutFile.WriteLine "Virus definitions are "& oDateDiff &" day(s) old"
Else
If bCreateLog Then WriteLog("Using McAfee Auto update Def date. ")
If (oDateDiff > 8) then
oOutFile.WriteLine "yellow+12h Test run at " & Now
Else oOutFile.WriteLine "green+12h Test run at " & Now
End If
oOutFile.WriteLine vbCrLf &"Found McAfee Enterprise Anti Virus definition file version:"
oOutFile.WriteLine oNDate &" Rev. "& oRev
oOutFile.WriteLine "Virus definitions are "& oDateDiff &" day(s) old"
end If
oOutFile.WriteLine "Check completed at "& Time
oOutFile.WriteBlankLines(3)
oOutFile.WriteLine "McAfee AV, McAv.vbs Version " & Version
oOutFile.WriteBlankLines(3)
oOutFile.WriteLine szLog
oOutFile.Close
Sub WriteLog(szText)
'Set oLogFile = oFSO.OpenTextFile (ExtPath &"\sigav.log", ForAppending,True)
'oLogFile.WriteLine (szText & " Current time is " & time)
'oLogFile.Close
szLog = szLog & szText & VbCrLf
End Sub