The test returns under reply "Last Update: DD/MM/YYYY"
Test will go bad if definitions are older than 1 day old, or if there is no AV file found.
Code: Select all
Option Explicit
const statusAlive = "Host is alive:"
const statusDead = "No answer:"
const statusUnknown = "Unknown:"
const statusNotResolved = "Unknown host:"
const statusOk = "Ok:"
const statusBad = "Bad:"
const statusBadContents = "Bad contents:"
FUNCTION PerformTest()
Dim VirusDat, oFile, oLine, oUpdateDefDate
Dim FirstChar, EndChar, NumberofChars
Dim oFSO
Set oFSO = CreateObject("Scripting.FileSystemObject")
VirusDat = "C:\Documents and Settings\All Users\Application Data\Symantec\Symantec Endpoint Protection\CurrentVersion\Data\Definitions\VirusDefs\definfo.dat"
'Maybe AV ver 11?
If NOT oFSO.FileExists(VirusDat) Then
VirusDat = "C:\Program Files\Common Files\Symantec Shared\VirusDefs\definfo.dat"
End If
If oFSO.FileExists(VirusDat) Then
Set oFile = oFSO.OpenTextFile(VirusDat)
Do Until oFile.AtEndofStream
oLine = oFile.ReadLine
If InStr(oLine, "CurDefs=") > 0 Then
FirstChar = InStr(oLine, "CurDefs=") + 8
EndChar = InStr(FirstChar, oLine, ".")
NumberofChars = EndChar - FirstChar
oUpdateDefDate = Mid(oLine, FirstChar, NumberofChars)
oUpdateDefDate = Mid(oUpdateDefDate, 7, 2) & "/" & Mid(oUpdateDefDate, 5, 2) & "/" & Mid(oUpdateDefDate, 1, 4)
If DateDiff("d", oUpdateDefDate, Now) > 1 Then
PerformTest = statusBad+"Last Update: " & oUpdateDefDate
Else
PerformTest = statusOk+"Last Update: " & oUpdateDefDate
End If
End If
Loop
Else
PerformTest = statusBad+"No File"
End If
end Function