IT Management Suite

Need VB/ WMI script to automate SAV 10.1.X installation & Uninstallation

  • 1.  Need VB/ WMI script to automate SAV 10.1.X installation & Uninstallation

    Posted Apr 10, 2008 03:14 AM
    Hi, I am new to this forum, i need your help. My requirement is to have a script which will check the version of Symantec Antivirus (SAV) Corporate Edition 10.1.4.4000 on client machines. 1. It has to find the Version of SAV installed. 2. Virus definition Info. 3. Corrupted/ Not 4. Parent Servername. 5. Reinstall incase of Corrupted SAV. I have found some of the scripts in online. but they seems to be related to finding version, moving GRC. My clients are installed with both Symantec Antivirus alone and Laptops are installed with Symantec Client Security which has Symantec Client Firewall included. First, i want to work on the Antivirus only client machines. Pls find the scripts which i found in this forum & also in other sites. If you are following some other technique, pls share it with me. my mail id : jsankr@gmail.com code:
    Title Installing Symantec Antivirus...
    @ECHO OFF
    ECHO
    ECHO
    ECHO
    ECHO
    ECHO
    Echo Uninstalling Symantec Antivirus
    Echo The password to uninstall Symantec Antivirus is: password
    IF EXIST "C:\Program Files\Symantec AntiVirus\VPTray.exe" msiexec /uninstall "Symantec AntiVirus.msi"
    
    "Symantec AntiVirus.msi" /qb RUNLIVEUPDATE=0 REBOOT=REALLYSUPPRESS
    
    copy "C:\Documents and Settings\All Users\Start Menu\Programs\Symantec Client Security\Symantec AntiVirus.lnk" "C:\Documents and Settings\All Users\Start Menu\Programs\Anti-Virus"
    
    rmdir /S /Q "C:\Documents and Settings\All Users\Start Menu\Programs\Symantec Client Security"
    
    ECHO Updating Symantec Antivirus with the latest virus definitions
    "C:\program files\symantec antivirus\VPDN_LU.exe" /s
    
    exit
    
    -----------------------------------------------------
    
    Code 2:
    On Error Resume Next
    
    Const ForReading = 1
    Const HKEY_LOCAL_MACHINE = &H80000002
    x = 2
    
    'Create an Excel Work Sheet
    
    Set objExcel = CreateObject("Excel.Application")
    objExcel.Visible = True
    objExcel.Workbooks.Add
    
    objExcel.Cells(1, 1).Value = "Machine Name"
    objExcel.Cells(1, 2).Value = "Parent Server"
    objExcel.Cells(1, 3).Value = "SAV Version"
    objExcel.Cells(1, 4).Value = "Virus Definition"
    objExcel.Cells(1, 5).Value = "Rev Number"
    objExcel.Cells(1, 6).Value = "Status"
    objExcel.Cells(1, 7).Value = "Report Time Stamp"
    
    objExcel.Range("A1:G1").Select
    objExcel.Selection.Interior.ColorIndex = 19
    objExcel.Selection.Font.ColorIndex = 11
    objExcel.Selection.Font.Bold = True
    objExcel.Cells.EntireColumn.AutoFit
    
    
    'Read machine names from a txt file
    
    Set Fso = CreateObject("Scripting.FileSystemObject")
    Set InputFile = fso.OpenTextFile("MachineList.Txt")
    Do While Not (InputFile.atEndOfStream)
    strComputer = InputFile.ReadLine
    
    intRow = x
    
    objExcel.Cells(intRow, 1).Value = strComputer
    
    GetRegInfo
    
    GetDefInfo
    
    objExcel.Cells(intRow, 7).Value = Now()
    
    set strValue = Nothing
    set dwValue = Nothing
    set strSavVersion = Nothing
    set objFSO = Nothing
    Set objFile = Nothing
    Set dtDefDate = Nothing
    Set strRevNumber= Nothing
    
    x = x + 1
    
    Loop
    
    Wscript.Echo "Done"
    
    '*********************************************************************************************************
    'Get information from Registry
    
    Sub GetRegInfo
    
    Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
    
    strKeyParentPath = "SOFTWARE\INTEL\LANDesk\VirusProtect6\CurrentVersion\"
    
    strKeyVerPath = "SOFTWARE\INTEL\DLLUsage\VP6\"
    
    strParent = "Parent"
    
    strProversion = "C:\Program Files\Symantec AntiVirus\Rtvscan.exe"
    
    oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyParentPath,strParent,strValue
    
    wshExcel.Cells(intRow, 2).Value = strValue
    
    oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyVerPath,strProversion,strSavVersion
    
    wshExcel.Cells(intRow, 3).Value = strSavVersion
    
    End Sub
    
    '*******************************************************************************************************************
    'Get Virus definition from definfo.dat.
    
    Sub GetDefInfo
    
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    
    Set objFile = objFSO.GetFile( "\\" & strComputer & _
      "\c$\Program Files\Common Files\Symantec Shared\VirusDefs\definfo.dat")
    
    If objFSO.FileExists(objFile) Then
    Set objDatFile = objFSO.OpenTextFile(objFile, 1)
    Do Until objDatFile.AtEndOfStream
    strLine = objDatFile.Readline
    intCurDefs = InStr(strLine , "CurDefs")
       If intCurDefs > 0 Then
       strCurDefs = strLine
       strDateDefs = Mid(strCurDefs, 9, 8)
    
       dtYear = Left(strDateDefs, 4)
       dtMonth = Mid(strDateDefs, 5, 2)
       dtDay = Right(strDateDefs, 2)
       DateVirDefs = dtMonth & "/" & dtDay & "/" & dtYear
       dtDefDate = CDate(DatevirDefs)
    
       objExcel.Cells(intRow, 4).Value = dtDefDate
    
     If (date - dtDefDate) = 1 Then
     objExcel.Cells(intRow, 6).Value = "OK"
     Else
     objExcel.Cells(intRow, 6).Value = "Need Attention!"
     End If
     
       strRevNumber = Right(strCurDefs, 3)
       objExcel.Cells(intRow, 5).Value = strRevNumber
        
       End If
       Loop
       objDatFile.Close
    
    Else
    objExcel.Cells(intRow, 4).Value = "The file definfo.dat does not exist"
    
    End If
    
    End Sub
    
    
    ------------------------------------------------------