Doc,

Here are a couple of changes.. For McAfee, you may want to include the Dat Date and whether or not the client has ePO installed. Anyway, here are the code changes:

Code:

Break On
Dim $SO
$SO=SetOption('NoVarsInStrings','On')
$SO=SetOption('WrapAtEOL','On')

If Not $sComputer $sComputer=@WKSTA EndIf
$AVDetails = AVClicked()
get $
Function AVClicked()
$AVProduct = GetAVProduct($sComputer)
If @ERROR ? 'The GetAVProduct UDF did not detect any supported AntiVirus' + @CRLF +
'There does not appear to be any supported Antivirus prodcut installed on ' + $sComputer
Exit 1
Else
? ':: GetAVProduct UDF ::'
? 'AV Product name: ' + $AVProduct ?
EndIf
$AVService = GetAVService($AVProduct, $sComputer)
If @ERROR ? 'The GetAVService UDF detected a service error for ' + $AVProduct + @CRLF +
'on ' + $sComputer
Exit 1
Else
? ':: GetAVService UDF ::'
? 'Start Mode: ' + $AVService[0]
? 'State: ' + $AVService[1]
? 'Account: ' + $AVService[2]
? 'Path: ' + $AVService[3] ?
EndIf
$AVVersion = GetAVVersion($AVProduct, $sComputer)
If @ERROR
? ':: GetAVVersion UDF ::'
? 'ERROR: No additional details for ' + $AVProduct + ' detected'
Exit 1
Else
Select
Case InStr($AVProduct,'AntiVirus')
? ':: GetAVVersion UDF ::'
? 'Engine: ' + $AVVersion[0]
? 'Date: ' + $AVVersion[1]
? 'Age: ' + $AVVersion[2]
? 'Parent: ' + $AVVersion[3]
? 'Client Type: ' + $AVVersion[4]
? 'Install Path: ' + $AVVersion[5]
Case InStr($AVProduct,'Shield')
? ':: GetAVVersion UDF ::'
? $AVVersion[0]
? $AVVersion[1]
? $AVVersion[2]
? $AVVersion[3]
? $AVVersion[4]
? $AVVersion[5]
If $AVVersion[6]
? ' === ePolicy Orchestrator was found ==='
? $AVVersion[6]
ENDIF
Case InStr($AVProduct,'ntrtscan')
? ':: GetAVVersion UDF ::'
? $AVVersion[0]
? $AVVersion[1]
? $AVVersion[2]
? $AVVersion[3]
? $AVVersion[4]
? $AVVersion[5]
? $AVVersion[6]
EndSelect
? 'Process is complete'
? 'Press a key...'?
EndIf
Endfunction

Function GetAVProduct($sComputer)
Dim $AVServices,$objWMI,$Index
$Index = 0
$AVServices = 'Norton AntiVirus Server','Symantec AntiVirus','McShield','ntrtscan'
$objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\"+$sComputer+"\root\cimv2")
If @ERROR<0 Exit Val("&"+Right(DecToHex(@ERROR),4)) EndIf
Do
$objSrvc = $objWMI.ExecQuery('Select * from Win32_Service WHERE Name = "' + $AVServices[$Index] +'"')
If @ERROR<0 Exit Val("&"+Right(DecToHex(@ERROR),4)) EndIf
For Each $svc In $objSrvc
If InStr($svc.Name,$AVServices[$Index])
$AVName = $svc.Name
EndIf
Next
$Index = $Index + 1
Until $AVName Or $Index = UBound($AVServices)+1
If Not $AVName Exit 1 EndIf
$GetAVProduct=$AVName
EndFunction

Function GetAVService($AVProduct, $sComputer)
Dim $objWMI,$objSrvc,$AVState,$AVStartMode,$AVAccount,$AVPath
$objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\"+$sComputer+"\root\cimv2")
If @ERROR<0 Exit Val("&"+Right(DecToHex(@ERROR),4)) EndIf
$objSrvc = $objWMI.ExecQuery('Select * from Win32_Service WHERE Name = "' + $AVName +'"')
If @ERROR<0 Exit Val("&"+Right(DecToHex(@ERROR),4)) EndIf
For Each $svc in $objSrvc
$AVStartMode = $svc.StartMode
$AVState = $svc.State
$AVAccount = $svc.StartName
$AVPath = $svc.PathName
Next
$GetAVService=$AVStartMode,$AVState,$AVAccount,$AVPath
EndFunction

Function GetAVVersion($AVProduct, $sComputer)
Dim $AVVersion
Select
Case InStr($AVProduct,'AntiVirus')
$AVVersion = GetSymantecAV($sComputer)
Case InStr($AVProduct,'shield')
$AVVersion = GetMcAfeeAV($sComputer)
Case InStr($AVProduct,'ntrtscan')
$AVVersion = GetTrendAV($sComputer)
Case 1
Exit 1
EndSelect
$GetAVVersion=$AVVersion
EndFunction

Function GetSymantecAV($sComputer)
Dim $ReadClientType,$DatNum,$AVAge,$AVInstallPath,$AVEngine,$AVParent,$ClientType
$ReadClientType = ReadValue('\\'+$sComputer+'\'+'HKLM\SOFTWARE\INTEL\LANDesk\VirusProtect6\CurrentVersion', 'ClientType')
If @ERROR Exit @ERROR EndIf
$DatNum = Left(Right(ReadValue('\\'+$sComputer+'\'+'HKLM\SOFTWARE\Symantec\SharedDefs','NAVCORP_70'),12),8)
$Datnum = Left($Datnum,4) + '/' + SubStr($Datnum,5,2) + '/' + Right($Datnum,2) ;convert to format for DateCalc UDF
$AVAge = DateCalc(@DATE, $DatNum)
$AVInstallPath = '\\'+$sComputer+'\'+Join(Split(ReadValue('\\'+$sComputer+'\'+'HKLM\software\INTEL\LANDesk\VirusProtect6\CurrentVersion\', 'Home Directory'),':'),Chr(36))
$AVEngine = GetFileVersion($AVInstallPath +'\vpc32.exe','ProductVersion')
$AVParent = ReadValue('\\'+$sComputer+'\'+'HKLM\SOFTWARE\Intel\LANDesk\VirusProtect6\CurrentVersion','Parent')
Select
Case $ReadClientType = 1 $ClientType = 'Connected Client'
Case $ReadClientType = 2 $ClientType = 'Stand-alone Client'
Case $ReadClientType = 4 $ClientType = 'Server'
If $NavParent = ""
$ClientType = 'Primary Server'
EndIf
Case $ReadClientType = "" $ClientType = 'Unknown'
EndSelect
$GetSymantecAV=$AVEngine,$DatNum,$AVAge,$AVParent,$ClientType,$AVInstallPath
EndFunction

Function GetMcAfeeAV($sComputer)
Dim $AVMcafee,$Tvd,$PName,$DatNum,$DatDate,$AVEngine,$Product,$SupportURL,$epo
$AVMcafee = '\\'+$sComputer+'\' + 'HKLM\SOFTWARE\McAfee\VirusScan'
$Tvd = '\\'+$sComputer+'\' + 'HKLM\SOFTWARE\Network Associates\TVD'
Select
Case KeyExist($Tvd+'\VirusScan Enterprise\CurrentVersion')
; VS70 - Works with 7.0 and 7.1, and 8.0
$PName = 'VirusScan Enterprise'
$DatNum = 'DAT File Version: ' + ReadValue($Tvd+'\VirusScan Enterprise\CurrentVersion','szVirDefVer')
$DatDate = 'DAT File Date: ' + ReadValue($Tvd+'\VirusScan Enterprise\CurrentVersion','szVirDefDate')
$AVEngine = 'Engine Version: ' + ReadValue($Tvd+'\Shared Components\VirusScan Engine\4.0.xx','szEngineVer')
$Product = 'Product Version: ' + ReadValue($Tvd+'\VirusScan Enterprise\CurrentVersion','szProductVer')
$SupportURL = 'Support URL: ' + ReadValue($Tvd+'\VirusScan Enterprise\CurrentVersion','szSupportURL')
IF READVALUE('HKLM\SOFTWARE\Network Associates\ePolicy Orchestrator\Agent','Installed Path')<>''
$epo = 'EPO Path: ' + READVALUE('HKLM\SOFTWARE\Network Associates\ePolicy Orchestrator\Agent','Installed Path')
ENDIF
Case KeyExist($Tvd+'\VirusScan')
; VS451
$PName = 'VirusScan 4.51'
$Datnum = 'DAT File Version:=' + SubStr(ReadValue($Tvd+'\Shared Components\VirusScan Engine\4.0.xx','szDatVersion'),5,4)
$AVEngine = 'Engine Version:=' + ReadValue($Tvd+'\Shared Components\VirusScan Engine\4.0.xx','szEngineVer')
$Product = 'Product Version:=' + ReadValue($Tvd+'\VirusScan','szCurrentVersionNumber')
Case KeyExist($Tvd+'\Netshield NT\CurrentVersion')
; NS45
$PName = 'NetShield NT 4.5'
$Datnum = 'DAT File Version:=' + SubStr(ReadValue($Tvd+'\Netshield NT\CurrentVersion','szVirDefVer'),5,4)
$AVEngine = 'Engine Version:=' + ReadValue($Tvd+'\Netshield NT\CurrentVersion','szEngineVer')
$Product = 'Product Version:=' + ReadValue($Tvd+'\Netshield NT\CurrentVersion','szProductVer')
Case KeyExist($sComputer+'HKLM\SOFTWARE\Network Associates\NetShield NT')
; NS403a
$PName = 'NetShield NT 4.03a'
$Datnum = 'DAT File Version:=' + SubStr(ReadValue($AVMcafee,'szVirDefVer'),5,4)
$AVEngine = 'Engine Version:=' + ReadValue($AVMcafee,'szEngineVer')
$Product = 'Product Version:=' + ReadValue($AVMcafee,'szProductVer')
EndSelect
$GetMcAfeeAV = $PName,$DatNum,$DatDate,$AVEngine,$Product,$SupportURL,$epo
EndFunction

Function GetTrendAV($sComputer)
Dim $AVEngine,$VSApiNT,$TmFilter,$DatNum,$Pattern,$AVInstallPath,$AVAge
$AVInstallPath = '\\'+$sComputer+'\'+Join(Split(ReadValue('\\'+$sComputer+'\'+'HKLM\SOFTWARE\TrendMicro\PC-cillinNTCorp\CurrentVersion','Application Path'),':'),Chr(36))
$AVEngine = 'Engine: ' + GetFileVersion($AVInstallPath +'\NTRtScan.exe','FileVersion')
$VSApiNT = 'VSApiNT: ' + GetFileVersion($AVInstallPath +'\vsapint.sys','FileVersion')
$TmFilter = 'TmFilter: ' + GetFileVersion($AVInstallPath +'\tmfilter.sys','FileVersion')
$Pattern = 'Pattern: ' + ReadValue('\\'+$sComputer+'\'+'HKLM\SOFTWARE\TrendMicro\PC-cillinNTCorp\CurrentVersion\Misc.','InternalPatternVer')
$DatNum = 'Pattern Date: ' + ReadValue('\\'+$sComputer+'\'+'HKLM\SOFTWARE\TrendMicro\PC-cillinNTCorp\CurrentVersion\Misc.','PatternDate')
$AVAge = 'Age: ' + FormatDate(ReadValue('\\'+$sComputer+'\'+'HKLM\SOFTWARE\TrendMicro\PC-cillinNTCorp\CurrentVersion\Misc.','PatternDate'))[1]
$GetTrendAV=$AVEngine,$VSApiNT,$TmFilter,$DatNum,$Pattern,$AVAge,$AVInstallPath
EndFunction

Function DateCalc($date1, $DateOrMod)
Dim $_intDate1, $_intYear1, $_intMonth1, $_intDay1
Dim $_intDate2, $_intYear2, $_intMonth2, $_intDay2
If InStr ($date1,'/') <> 5
Or InStrRev ($date1,'/') <> 8
Or Len ($date1) <> 10
Exit (1)
EndIf
$_intYear1 = Val(SubStr($date1,1,4))
$_intMonth1 = Val(SubStr($date1,InStr($date1,'/')+1,2))
$_intDay1 = Val(SubStr($date1,InStrRev($date1,'/')+1,2))
If $_intMonth1 < 3
$_intMonth1 = $_intMonth1 + 12
$_intYear1 = $_intYear1 - 1
EndIf
$_intDate1 = $_intDay1 + ( 153 * $_intMonth1 - 457 ) / 5 + 365 * $_intYear1 +
$_intYear1 / 4 - $_intYear1 / 100 + $_intYear1 / 400 - 306
Select
Case VarType($DateOrMod) = 3
$_intDate2 = $_intDate1 + $DateOrMod
If InStr($_intDate2,'-') $_intDate2 = Val(SubStr($_intDate2,2,Len($_intDate2)-1)) EndIf
$_intYear2 = ( 100 * ( ( ( 100*($_intDate2+306)-25)/3652425)
- ( ((100*($_intDate2+306)-25)/3652425)/4)
) + (100*($_intDate2+306)-25)
) / 36525
$_intMonth2 = ( 5 * ( ( ( 100*($_intDate2+306)-25)/3652425)
- ( ((100*($_intDate2+306)-25)/3652425)/4)
+ ($_intDate2+306) - 365 * $_intYear2 - $_intYear2 / 4
) + 456
) / 153
$_intDay2 = ( ( ( 100*($_intDate2+306)-25)/3652425)
- ( ((100*($_intDate2+306)-25)/3652425)/4)
+ ($_intDate2+306) - 365 * $_intYear2 - $_intYear2 / 4
) - ( 153 * $_intMonth2 - 457
) / 5
If $_intMonth2 > 12 $_intYear2 = $_intYear2 + 1 $_intMonth2 = $_intMonth2 - 12 EndIf
If Len($_intYear2 ) < 4
$_ = Execute("for $i=1 to 4-Len($$_intYear2) $$_intYear2 = '0' + $$_intYear2 next")
EndIf
If Len($_intMonth2) < 2 $_intMonth2 = "0$_intMonth2" EndIf
If Len($_intDay2 ) < 2 $_intDay2 = "0$_intDay2" EndIf
$DateCalc = '$_intYear2/$_intMonth2/$_intDay2'
Case VarType($DateOrMod) = 8
If InStr ($DateOrMod,'/') <> 5
Or InStrRev ($DateOrMod,'/') <> 8
Or Len ($DateOrMod) <> 10
Exit (1)
EndIf
$_intYear2 = Val(SubStr($DateOrMod,1,4))
$_intMonth2 = Val(SubStr($DateOrMod,InStr($DateOrMod,'/')+1,2))
$_intDay2 = Val(SubStr($DateOrMod,InStrRev($DateOrMod,'/')+1,2))
If $_intMonth2 < 3
$_intMonth2 = $_intMonth2 + 12
$_intYear2 = $_intYear2 - 1
EndIf
$_intDate2 = $_intDay2 + ( 153 * $_intMonth2 - 457 ) / 5 + 365 * $_intYear2 +
$_intYear2 / 4 - $_intYear2 / 100 + $_intYear2 / 400 - 306
$DateCalc = $_intDate1 - $_intDate2
;comment the next line If you wish to return negative results also !!!
If InStr($DateCalc,'-') $DateCalc = Val(SubStr($DateCalc,2,Len($DateCalc)-1)) EndIf
Case 1
Exit (1)
EndSelect
EndFunction

Function FormatDate($Entry)
Dim $Year, $Month, $Day,$Date
If Not $Entry Exit 1 EndIf
$Year = SubStr($Entry,1,4)
$Month = SubStr($Entry,5,2)
$Day = SubStr($Entry,7,2)
$Date = $Year+'/'+$Month+'/'+$Day
$FormatDate=$Date,DateCalc(@DATE,$Date)
EndFunction



Thanks,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's