|
I wrote this script for my sites, it works every day on several thousand desktops..
all you have to do is change the name agydev to whatever the server name is.. it also copies down the certificate file
on the server you will need to give the users group access to the pki\roots folder (read access).
$homedir=%windir% $systemdir=$homedir + \SYSTEM32
:checkinstallation $checkinstall=READVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\INTEL\LANDesk\VirusProtect6\CurrentVersion\LiveUpdate\CmdLines\CmdLine4", "ProductVersion") IF $checkinstall="" ;Symantec antivirus not installed MessageBox ("Symantec Antivirus is not installed, Please see your tech specialist to get it installed", "Server Compliance Notice") Goto End Else goto checksavverversion ;MessageBox ("$checkinstall", "Server Compliance Notice") ENDIF
:checksavverversion $checksavver=READVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\INTEL\LANDesk\VirusProtect6\CurrentVersion\LiveUpdate\CmdLines\CmdLine4", "ProductVersion") IF $checksavver="8.0" ;Symantec Version 8.0 MessageBox ("Your Symantec Antivirus Version is $checksavver, Please see your tech specialist to get upgraded to version 10", "Incorrect version of Symantec Antivirus Detected") Goto End Else ;Symantec version 10.0 ;MessageBox ("Symantec Antivirus Version is $checksavver", "Sav Version") ENDIF
:checkappdata $checkappdatapath=READVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", "Common AppData") ;MessageBox ("Your Application Path is $checkappdatapath", "Application Data Path is")
:checkinstallpath $checkinstallationpath=READVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\INTEL\LANDesk\VirusProtect6\CurrentVersion", "Home Directory") ;MessageBox ("Your Install Path is $checkinstallationpath", "Home Directory Path is")
:checkdir ;This section checks to see if the local workstation path for the grc exists for symantec 10.0 $workstationfolderpath = "$checkappdatapath\Symantec\Symantec AntiVirus Corporate Edition\7.5" ;MessageBox ("Default Grc path is $workstationfolderpath", "Workstation folder path") If Exist ($workstationfolderpath) ;MessageBox ("Grc Directory Exists, and is $workstationfolderpath", "Debug") ;now that I have the correct directory structure, I can continue goto delfiles Else ;MessageBox ("Grc Directory Does not Exist, and is $workstationfolderpath", "Debug") ;what this means is that sav was installed but currently there is no directory structure left. goto end EndIf
:delfiles $grcfile = "grc.dat" $grcfull = $workstationfolderpath + "\" + $grcfile ;MessageBox ("Grc path is $grcfull", "Grc.dat File Check") If EXIST ($grcfull) ;MessageBox ("File Exists", "Grc.dat File Check") del $grcfull ELSE ;MessageBox ("File Does Not Exist, and is $grcfull", "Grc.dat File Check") ENDIF
:delfiles1 $cerfile = "*.cer" $cerfull = $checkinstallationpath + "pki\roots\" + $cerfile ;MessageBox ("$cerfile", "cer File Check") ;MessageBox ("The full path for the certificate file is $cerfull", "cer File Check") If EXIST ($cerfull) ;MessageBox ("File Exists", "*.cer File Check") del $cerfull ELSE ;MessageBox ("File Does Not Exist, and is $cerfull", "*.cer File Check") ENDIF
:checkserver ;This section will then check if it can see the server \\AGYDEV\vphome directory ;To copy the grc.dat file down (grc.dat should be in \\AGYDEV\vphome $ServerFolderPath = "\\AGYDEV\VPHOME" If Exist ($ServerFolderPath) ;MessageBox ("Server Folder Path exists!", "Sav Path on server");if the folder exists then it will commence the copy COPY "\\AGYDEV\vphome\grc.dat" "$checkappdatapath\Symantec\Symantec AntiVirus Corporate Edition\7.5" /r COPY "\\AGYDEV\vphome\pki\roots\*.cer" "$checkinstallationpath\pki\roots" /r ;if it can't find the file it will continue on error Else ;no rights to the server ;MessageBox ("Sav Folder on server Doesn't Exist!", "Sav Path on server") goto end EndIf
:End
|