here's the final script

One caveat here, you have to give the everyone group rights to the
C:\Program Files\Symantec AntiVirus\pki\roots
I gave them list and read rights not read&execute

This will allow the certificate copy

Code:

$homedir=%windir%
$systemdir=$homedir + \SYSTEM32

:checkinstallation
$checkinstall=READVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\INTEL\LANDesk\VirusProtect6\CurrentVersion\LiveUpdate\CmdLines\CmdLine4", "ProductVersion")
IF $checkversion=""
goto checksavverversion
Else
;Symantec antivirus not installed
;MessageBox ("Symantec Antivirus is not installed, Please see your techspecialist to get it installed", "Server Compliance Notice")
Goto End
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 $checkverupdate, Please see your techspecialist to get upgraded to version 10", "Incorrect version of Symantec Antivirus Detected")
Goto End
Else
;Symantec version 10.0
;MessageBox ("Symantec Antivirus Version is $checkverupdate", "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 "\\AGYxxx\vphome\grc.dat" "$checkappdatapath\Symantec\Symantec AntiVirus Corporate Edition\7.5" /r
COPY "\\AGYxxx\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



Edited by NTDOC to place within Code Tags


Edited by NTDOC (2006-05-22 10:09 PM)