(view source code of savver.vbs as plain text)
Option ExplicitOn Error Resume Next
Dim drive, fso, SAVDef, SAVDir1, SAVDir2, SAVDir3, SAVVer, strComputer, strMsgstrMsg = vbCrLf' Parse command lineIf WScript.Arguments.Named.Count > 0 Then Syntax
If WScript.Arguments.UnNamed.Count > 1 Then Syntax
If WScript.Arguments.UnNamed.Count = 1 Then
If Ping( WScript.Arguments.UnNamed(0) ) Then
strComputer = GetComputerName( WScript.Arguments.UnNamed(0) )
drive = "\\" & strComputer & "\C$"
ElsestrMsg = strMsg & WScript.Arguments.UnNamed(0) & " is off-line" & vbCrLf & vbCrLf
Syntax
End If
Elsedrive = "C:"
strComputer = GetComputerName( "." )
End If
' Specify file locationsSAVDir1 = drive & "\Program Files\SAV"
SAVDir2 = drive & "\Program Files\Symantec AntiVirus"
SAVDir3 = drive & "\Program Files\Common Files\Symantec Shared\VirusDefs"
' Create file system objectSet fso = CreateObject( "Scripting.FileSystemObject" )
' Retrieve program file version infoSAVVer = fso.GetFileVersion( SAVDir1 & "\Rtvscan.exe" ) & fso.GetFileVersion( SAVDir2 & "\Rtvscan.exe" )
' Retrieve definitions file version infoSAVDef = ReadINI( SAVDir3 & "\definfo.dat", "DefDates", "CurDefs" )
' Display the resultstrMsg = strMsg _& "Computer Name : " & strComputer & vbCrLf _
& "Symantec AntiVirus version : " & SAVVer & vbCrLf _
& "Virus definitions : " & SAVDef & vbCrLf
WScript.Echo strMsg
' Get local computer nameFunction GetComputerName( strHost )
Dim colItems, objItem, objWMIServiceSet objWMIService = GetObject( "winmgmts://" & strHost & "/root/cimv2" )
Set colItems = objWMIService.ExecQuery( "Select * from Win32_ComputerSystem", , 48 )
For Each objItem in colItems
GetComputerName = objItem.Name
NextEnd Function
' Function to ping a specified host and returns boolean TRUE if it is contactable and FALSE if notFunction Ping( strHost )
' On Error Resume NextDim objPing : Set objPing = Nothing ' The Win32_PingStatus WMI object
Dim objStatus : Set objStatus = Nothing ' The result of the Win32_PingStatus WMI object
' Creates the ping object specifying the host to pingSet objPing = GetObject( "winmgmts:{impersonationLevel=impersonate}" ).ExecQuery( "SELECT * FROM Win32_PingStatus WHERE address = '" & strHost & "'" )
' Check the status of each ping responseFor Each objStatus In objPing
' If the status code is Null or Not 0 then the ping failedIf IsNull( objStatus.StatusCode ) Or objStatus.StatusCode <> 0 Then
' Set the function to return Boolean FALSEPing = False
Else ' Set the function to return Boolean TRUEPing = True
End If
NextEnd Function
Function ReadINI( ini, section, key )
'Initialize variables and constants Dim handle, keyfound, line, lineArray, linekey, lineval, objFso, sect, sectfoundConst ForReading = 1
sectfound = False
sect = "[" & Strip( section ) & "]"
keyfound = False
ReadINI = ""
'Open INI file in read-only modeSet objFso = CreateObject( "Scripting.FileSystemObject" )
Set handle = objFso.OpenTextFile( ini, ForReading )
'Search the INI file for the specified key in the specified sectionDo While handle.AtEndOfStream <> True And keyfound = False
line = Strip( handle.ReadLine )
If Left( line, 1 ) = "[" Then
If StrComp( line, sect, vbTextCompare ) = 0 Then
sectfound = True
Elsesectfound = False
End If
ElseIf sectfound Then
If InStr( 1, line, "=", vbTextCompare ) > 0 Then
lineArray = Split( line, "=", 2, vbTextCompare )
linekey = Strip( lineArray(0) )
lineval = Strip( lineArray(1) )
If StrComp( linekey, key, vbTextCompare ) = 0 Then
ReadINI = linevalkeyfound = True
End If
End If
End If
End If
Loop 'Close the filehandle.close
End Function
'Strip leading and trailing whitespace and quotes from a stringFunction Strip( mystring )
Do While Left( mystring, 1 ) = " " Or Left( mystring, 1 ) = Chr(9)
mystring = Mid( mystring, 2 )
LoopDo While Right( mystring, 1 ) = " " Or Right( mystring, 1 ) = Chr(9)
mystring = Mid( mystring, 1, Len( mystring ) - 1 )
LoopIf Left( mystring, 1 ) = Chr(34) Then
mystring = Mid( mystring, 2 )
End If
If Right( mystring, 1 ) = Chr(34) Then
mystring = Mid( mystring, 1, Len( mystring ) - 1 )
End If
Strip = mystringEnd Function
Sub Syntax strMsg = vbCrLf _& "SAVVer.vbs, Version 1.00" & vbCrLf _
& "Display Symantec AntiVirus program and definitions version" & vbCrLf & vbCrLf _
& "Usage: [ CSCRIPT ] SAVVER.VBS [ host ]" & vbCrLf & vbCrLf _
& "Where: " & Chr(34) & "host" & Chr(34) _
& " is a remote computer's name or IP address" & vbCrLf _
& " (default is the local computer)" & vbCrLf & vbCrLf _
& "Written by Rob van der Woude" & vbCrLf _
& "http://www.robvanderwoude.com"
WScript.Echo strMsg
WScript.Quit(1)
End Sub
page last modified: 2025-10-11; loaded in 0.0095 seconds