; AVVer.kix, Version 1.05 ; Checks the number of days passed since the last update of ; Symantec AntiVirus Corporate Edition 8's or Network Associates' ; McAfee 4 virus definitions and generates a message if it exceeds ; the specified limit. ; ; Usage: KIX32 AVVER.KIX [ $MaxDefAge=nn ] ; ; Where: nn is the maximum time allowed since the last update ; ; Written by Rob van der Woude ; http://www.robvanderwoude.com ; ; Note: This script and its author are in NO way associated ; with neither Symantec nor Network Associates. ; Hide console window $x = SetConsole( "HIDE" ) ; Check if maximum virus definitions age ; is specified, otherwise use default value If $MaxDefAge = 0 $MaxDefAge = 14 EndIf ; This registry key specifies the last update ; of the SAV virus definitions in hexadecimal $SAVRegKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Symantec\SharedDefs\DefWatch" $DefVer = ReadValue( $SAVRegKey, "DefVersion" ) If $DefVer ; If the key has any value, Symantec AntiVirus ; Corporate Edition is probably installed $AVType = "SAV" $AVDescr = "Symantec AntiVirus Corporate Edition" ; Extract the day, month & year of the last update $LastUpdYrX = "&" + SubStr( $DefVer, 3, 2 ) + SubStr( $DefVer, 1, 2 ) $LastUpdYr = Val( $LastUpdYrX ) $LastUpdMnX = "&" + SubStr( $DefVer, 7, 2 ) + SubStr( $DefVer, 5, 2 ) $LastUpdMn = Val( $LastUpdMnX ) $LastUpdDyX = "&" + SubStr( $DefVer, 15, 2 ) + SubStr( $DefVer, 13, 2 ) $LastUpdDy = Val( $LastUpdDyX ) Else ; Let's try if McAfee is installed. ; This registry key specifies the last ; update of the McAfee virus definitions $McARegKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\TVD\" $McARegKey = $McARegKey + "Shared Components\VirusScan Engine\4.0.xx" $EngineVer = ReadValue( $McARegKey, "szEngineVer" ) If $EngineVer ; If this registry key has any value ; then McAfee is probably installed $AVType = "McAfee" $AVDescr = "McAfee VirusScan" ; Extract the day, month & year of the last update $DatDate = ReadValue( $McARegKey, "szDatDate" ) $DateArray = Split( "$DatDate", "/") For Each $Element In $DateArray Select Case $LastUpdDy $LastUpdYr = $Element Case $LastUpdMn $LastUpdDy = $Element Case 1 $LastUpdMn = $Element EndSelect Next Else ; We didn't find Symantec AntiVirus, nor McAfee ViruScan $Title = "AntiVirus" $Msg = "Neither Symantec nor McAfee AntiVirus are installed. " $Msg = $Msg + Chr(13) + Chr(10) + "Please contact your " $Msg = $Msg + "helpdesk for further instructions. " $x = MessageBox( $Msg, $Title, 64 ) Quit 1 EndIf EndIf ; Calculate the total number of days between January ; 1st and the last update, ignoring leap years Select Case $LastUpdMn = 1 $LastUpdTotDy = 0 + $LastUpdDy Case $LastUpdMn = 2 $LastUpdTotDy = 31 + $LastUpdDy Case $LastUpdMn = 3 $LastUpdTotDy = 59 + $LastUpdDy Case $LastUpdMn = 4 $LastUpdTotDy = 90 + $LastUpdDy Case $LastUpdMn = 5 $LastUpdTotDy = 120 + $LastUpdDy Case $LastUpdMn = 6 $LastUpdTotDy = 151 + $LastUpdDy Case $LastUpdMn = 7 $LastUpdTotDy = 181 + $LastUpdDy Case $LastUpdMn = 8 $LastUpdTotDy = 212 + $LastUpdDy Case $LastUpdMn = 9 $LastUpdTotDy = 243 + $LastUpdDy Case $LastUpdMn = 10 $LastUpdTotDy = 273 + $LastUpdDy Case $LastUpdMn = 11 $LastUpdTotDy = 304 + $LastUpdDy Case $LastUpdMn = 12 $LastUpdTotDy = 334 + $LastUpdDy EndSelect ; Calculate the number of days between today and the last update $DefsOld = ( 365 * ( @YEAR - $LastUpdYr ) ) + @YDAYNO - $LastUpdTotDy ; Send a message to the user if the definitions are too old If $DefsOld > $MaxDefAge $Title = "$AVType" $Msg = "Your virus definitions are $DefsOld days old." $Msg = $Msg + Chr(13) + Chr(10) + "Please contact " $Msg = $Msg + "your helpdesk for further instructions. " $x = MessageBox( $Msg, $Title, 64 ) EndIf ; Show console window again $x = SetConsole( "SHOW" )