#25707 - 2002-07-23 08:05 PM
ReadValue problems
|
Chris Beggs
Fresh Scripter
Registered: 2001-09-27
Posts: 27
Loc: Kitchener
|
I'm having a problem with a part of my scipt. I'm checking for a managed insatll of NAV Corp edition. I check for either of the server names otherwise I right a file and email. All NT 4.0 machines work fine but most 2000 Pro machines will send an email although the registry key and value exist. Here is my script. Any ideas?
Chris
$AV ="$HKLM\SOFTWARE\Intel\LANDesk\VirusProtect6\CurrentVersion" $AV=ReadValue ("$AV","Parent") if $AV = Thor goto "end" $AV=ReadValue ("$AV","Parent") if $AV = Tyr goto "end" else open(1, "c:\2kmanage.log", 5) ; Create a temp file writeline(1, "@FULLNAME does not have a managed Norton Installation" +chr(13) +chr(10) +chr(13) +chr(10)) writeline(1, "Workstation = @wksta" +chr(13) +chr(10)) writeline(1, "Operating System Kernel = " + $kernel +chr(13) +chr(10)) writeline(1, "Operating System = " + $system +chr(13) +chr(10)) writeline(1, "Operating System Subtype= " + $flavor +chr(13) +chr(10) +chr(10)) writeline(1, "Operating System Service Pack Level = " + $Svcpack +chr(13) +chr(10) +chr(10)) writeline(1, "Current time is @time" +chr(13) +chr(10)) ; Insert all this information in the file close(1) ; and mail the file to me for investigation with blat.exe shell \\freya\blat\2kmanage.bat sleep 1 del "c:\2kmanage.log" ; clean up cls use y: /d if ingroup ( "AV_Tyr" ) copy "@LDRIVE"+"\tyr\vphome\grc.dat" "c:\Documents and Settings\All Users\Application Data\Symantec\Norton AntiVirus Corporate Edition\7.5" if ingroup ( "AV_Thor" ) copy "@LDRIVE"+"\thor\vphome\grc.dat" "c:\Documents and Settings\All Users\Application Data\Symantec\Norton AntiVirus Corporate Edition\7.5" goto "end" endif :end exit
|
|
Top
|
|
|
|
#25709 - 2002-07-23 08:31 PM
Re: ReadValue problems
|
Dean B.
Fresh Scripter
Registered: 2002-02-04
Posts: 46
Loc: Allegan, MI USA
|
Chris -
You need to match up each IF statement with an ENDIF. Try this:
code:
$AVKey="$HKLM\SOFTWARE\Intel\LANDesk\VirusProtect6\CurrentVersion" $AV=ReadValue ("$AVKey","Parent") if $AV = "Thor" or $AV ="Tyr" ; do nothing else open(1, "c:\2kmanage.log", 5) ; Create a temp file writeline(1, "@FULLNAME does not have a managed Norton Installation" +chr(13) +chr(10) +chr(13) +chr(10)) writeline(1, "Workstation = @wksta" +chr(13) +chr(10)) writeline(1, "Operating System Kernel = " + $kernel +chr(13) +chr(10)) writeline(1, "Operating System = " + $system +chr(13) +chr(10)) writeline(1, "Operating System Subtype= " + $flavor +chr(13) +chr(10) +chr(10)) writeline(1, "Operating System Service Pack Level = " + $Svcpack +chr(13) +chr(10) +chr(10)) writeline(1, "Current time is @time" +chr(13) +chr(10)) ; Insert all this information in the file close(1) ; and mail the file to me for investigation with blat.exe shell \\freya\blat\2kmanage.bat sleep 1 del "c:\2kmanage.log" ; clean up cls use y: /d select case ingroup ( "AV_Tyr" ) copy "@LDRIVE"+"\tyr\vphome\grc.dat" "c:\Documents and Settings\All Users\Application Data\Symantec\Norton AntiVirus Corporate Edition\7.5" case ingroup ( "AV_Thor" ) copy "@LDRIVE"+"\thor\vphome\grc.dat" "c:\Documents and Settings\All Users\Application Data\Symantec\Norton AntiVirus Corporate Edition\7.5" endselect endif
Notice how the IF statement is supposed to work. Also, I replaced your other IF with a SELECT CASE structure. Let us know if this helps.
_________________________
Dean
|
|
Top
|
|
|
|
#25711 - 2002-07-23 08:40 PM
Re: ReadValue problems
|
Les
KiX Master
   
Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
|
|
|
Top
|
|
|
|
#25712 - 2002-07-23 08:45 PM
Re: ReadValue problems
|
Chris Beggs
Fresh Scripter
Registered: 2001-09-27
Posts: 27
Loc: Kitchener
|
Thanks for the help it works great now!! This forum really is the best. Everytime I've asked a question the answer is there in minutes.
I've changed the other IF statements to select statements as well.
Are select statements better than IF or does it matter?
Chris
|
|
Top
|
|
|
|
#25713 - 2002-07-23 08:56 PM
Re: ReadValue problems
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11631
Loc: CA
|
Jens and Les,
WRONG you are...
Generally speaking that folder area is not accessable for Everyone, but the last folder 7.5 has EVERYONE FULL rights by design from Symantec.
Here is some sample code for ideas as well.
code:
; *** File Name: NAVPARNT.KIX *** v1.6 ; *** Date Created: 09-19-2001 1:06 am PST - By Ron Lewis ; *** Comments: Reassigns the NAV Parent Server based on IP Address ; *** NOTE: Code may need to be modified to include actions when valid IP is not known.
; *** Variables *** $crlf = chr(13)+chr(10) ;chr(13) is a Carriage Return and chr(10) is a line feed $NavHomeDir = READVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\INTEL\LANDesk\VirusProtect6\CurrentVersion","Home Directory") $DataLocation = READVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", "Common AppData") $PARENT = READVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\Intel\LANDesk\VirusProtect6\CurrentVersion","Parent") $NoNavWarn = EXISTKEY("HKEY_LOCAL_MACHINE\SOFTWARE\INTEL\LANDesk\VirusProtect6\CurrentVersion\Quarantine") $CleanGRCx = 'attrib -r "$NavHomeDir\GRC.DAT"' $CleanGRCy = 'attrib -r "$DataLocation\Symantec\Norton AntiVirus Corporate Edition\7.5\GRC.DAT"'
IF @INWIN = 1 $SRVR = ReadValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions", "ProductType") IF $SRVR<>"WinNT" ; System is not a Workstation so assume it is a Server RETURN ENDIF ENDIF IF $NoNavWarn <> 0 $nul = MESSAGEBOX("Unable to locate the Norton AntiVirus program on this system. Please contact the Helpdesk to have the program installed or checked for problems with a previous installation.", "Norton AntiVirus Program Update", 16) GOTO END ENDIF
IF EXIST($NavHomeDir+"\GRC.DAT") SHELL $CleanGRCx DEL ($NavHomeDir+"\GRC.DAT") ENDIF IF EXIST("$DataLocation\Symantec\Norton AntiVirus Corporate Edition\7.5\GRC.DAT") SHELL $CleanGRCy DEL ("$DataLocation\Symantec\Norton AntiVirus Corporate Edition\7.5\GRC.DAT") ENDIF
SELECT CASE (SUBSTR(@IPADDRESS0,1,11)) = "122.100.243" AND $PARENT = "SERVER01" GOTO END CASE (SUBSTR(@IPADDRESS0,1,11)) = "123. 26.110" AND $PARENT = "SERVER02" GOTO END ; ETC.... ENDSELECT
SELECT CASE (SUBSTR(@IPADDRESS0,1,11)) = "122.100.243" $NavParent = "SERVER01" CASE (SUBSTR(@IPADDRESS0,1,11)) = "123. 26.110" $NavParent = "SERVER02" ; CASE ETC.... CASE 1 $NavParent = "SERVER01" ENDSELECT $GrcUpdateNew = '%comspec% /c copy "\\$NavParent\vphome\grc.dat" "$DataLocation\Symantec\Norton AntiVirus Corporate Edition\7.5\GRC.DAT" >nul' $GrcUpdateOld = '%comspec% /c copy "\\$NavParent\vphome\grc.dat" "$NavHomeDir" >nul'
IF @INWIN = 1 GOTO NTWIN ELSE GOTO WINX ENDIF GOTO END
:NTWIN IF (Exist($DataLocation+"\Symantec\Norton AntiVirus Corporate Edition\7.5\nul") = 1) $nul = MESSAGEBOX("Please wait... Norton AntiVirus Definitions are being updated on your system...", "Norton AntiVirus Program Update", 64, 10) SHELL $GrcUpdateNew SHELL '%comspec% /c NET STOP "Norton AntiVirus Client" >NUL' SHELL '%comspec% /c NET START "Norton AntiVirus Client" >NUL' GOTO END ELSE $nul = MESSAGEBOX("Please wait... Norton AntiVirus Definitions are being updated on your system...", "Norton AntiVirus Program Update", 64, 10) SHELL $GrcUpdateOld SHELL '%comspec% /c NET STOP "Norton AntiVirus Client" >NUL' SHELL '%comspec% /c NET START "Norton AntiVirus Client" >NUL' GOTO END ENDIF GOTO END
:WINX SHELL $GrcUpdateOld $nul = MESSAGEBOX("Notice: Norton AntiVirus Definitions were updated on your system. Please restart your computer to complete the Norton AntiVirus update once the logon script and any other applications have finished loading.", "Norton AntiVirus Program Update", 64) GOTO END
:END RETURN
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 764 anonymous users online.
|
|
|