Page 1 of 1 1
Topic Options
#46233 - 2003-10-01 09:42 AM Windows 98 Environment Variable
Annino Offline
Fresh Scripter

Registered: 2002-01-16
Posts: 6
Loc: Sydney
Hi all

Having a bit of an issue with one of my scripts. I'm setting a whole lot of environment variables at the start of my script, one being the HOMESERVER of a user. In another script, run a later on in the login script process, I want to update the Norton Anti Virus client to point to this %HOMESERVER% as it's Parent server. Problem is, when I set the environment variables while logging onto the domain, the variables are not recognised in the later scripts. If I perform a logoff and log on, the %HOMESERVER% variable works. No problems with Windows NT/2000/XP Can Kixtart access environment variables which it has set during the login process? I'bve tried using SETL, SETM, WINSET, and SET. Kixtart version 4.12 and the kxrpc service is installed on all my domain controllers. It just seems that any environment variable which I set during the first login of a PC isn't accessible by the system until windows has completely loaded up.

I'm also having this same problem for a user name envirnment variable getting written to a log file. The env variable is not recognised until the OS has fully loaded. Hmmmm.

Any ideas would be very much appreciated.

Top
#46234 - 2003-10-01 02:41 PM Re: Windows 98 Environment Variable
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
You should no longer need PUTINENV/WINSET to accomplish this..

SET should work straight away.. And if we look at the 4.12 Docs, it states that too.
quote:

On Windows 9x, sets environment variables in the global Windows environment (similar to the functionality offered by WINSET.EXE).

Can your post your code to set the enviroment variables?

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#46235 - 2003-10-01 02:44 PM Re: Windows 98 Environment Variable
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
The behaviour is as expected and fully explained in the manual. Why use environment variables at all? If you are setting them in KiX then you could simply use KiX variables.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#46236 - 2003-10-01 03:06 PM Re: Windows 98 Environment Variable
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
If during logon you run just 1 master script written in kixtart then as Les says you can use a global Kixtart variable. It will be available throughout the logon/Windows startup process.

If you are chaining a series of scripts called from a Batch file you have trouble. In this case you may have to experiment with the various Sets to discover which shell is the appropriate shell to write to. If this is the case you might look into using the DOS utility PUTENV which can write to specific shells if you know their literal system names. (This utility is not the same as PUTINENV whose main purpose is putting LANMAM variables into the environment.)

I recommend Les' suggestion.
_________________________
Jack

Top
#46237 - 2003-10-02 02:06 AM Re: Windows 98 Environment Variable
Annino Offline
Fresh Scripter

Registered: 2002-01-16
Posts: 6
Loc: Sydney
Here's a excerpt from the script. The reason I was trying to use an environment variable is so that if someone that is not familiar with the script looks at the script N.A.V. update script, they'll more than likely know what %HOMESERVER% is compared to something like $HOMESERVER. Like I said before though, it's strange that the %HOMESERVER% env variable isn't set ubntil the OS has fully completed loading. Even if you do a logoff and log back on, the env variable works. It just that initial time from when the PC is first powered up. I'll use the Kix variable for the time being as a work around.

Thanks for your feedback guys. Below is an excerpt from the two scripts. The Set Env Vars script, and the script that gets called later on to update the N.A.V. client. Each of our server names has been kept to an 8 character standard.

; SetEnvVars.Kix
; --------------

$U = "Unknown"

$HOMESHARE=UCASE(@HOMESHR)
IF $HOMESHARE
$HOMESERVER=SUBSTR($HOMESHARE,3,8)
ENDIF

IF $HOMESERVER
SETL "HOMESERVER=$HOMESERVER"
SET "HOMESERVER=$HOMESERVER"
SETM "HOMESERVER=$HOMESERVER"
SHELL "%COMSPEC% /C $WINSET HOMESERVER=$HOMESERVER"
ELSE
SETL "HOMESERVER=$U"
SHELL "%COMSPEC% /C $WINSET HOMESERVER=$U"
$HOMESERVER=$U
ENDIF
? " Windows NT Home Server : " + $HOMESERVER

; NAVGRCUpdate.Kix
; ----------------

$KEYVALUE = READVALUE("HKLM\SOFTWARE\CCA\NAV","ParentServer")

IF $KEYVALUE <> %HOMESERVER%
SELECT
CASE @PRODUCTTYPE = "Windows 95" or @PRODUCTTYPE = "Windows 98" or @PRODUCTTYPE = "Windows Me"

If EXIST ("C:\Program Files\Norton AntiVirus")
COPY "\\%HOMESERVER%\VPHOME\GRC.dat" "C:\Program Files\Norton AntiVirus\"
WRITEVALUE("HKLM\SOFTWARE\CCA\NAV","ParentServer","%HOMESERVER%","REG_SZ")
Else
If $KEYVALUE = "NO"
GOTO "END"
Else
GOSUB UPDATELOGFILE
WRITEVALUE("HKLM\SOFTWARE\CCA\NAV","ParentServer","NO","REG_SZ")
EndIf
EndIf

[ 02. October 2003, 02:11: Message edited by: Annino ]

Top
#46238 - 2003-10-02 02:35 AM Re: Windows 98 Environment Variable
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
Hi Annino

Not to sound harsh, but if someone looks at it and does not understand it, then they probably don't belong working on it.

As for the code, you should never hard code a path if at all possible. Try reading from the Registry to gain the correct path/location. That will ensure you have a better chance of your code always working even on oddly setup systems.

This board has many NAV scripts and we also have at least one or more NAV UDF files as well.

Please take a look at them for further ideas, or search the board for specific other items of interest about NAV.

Top
#46239 - 2003-10-02 02:48 AM Re: Windows 98 Environment Variable
Annino Offline
Fresh Scripter

Registered: 2002-01-16
Posts: 6
Loc: Sydney
Excellent point about hard coding a path into the script. Not normally my method but just wanted to get this working initially. I've been testing with NAV 7.5 and decided to try an install of NAV 8.0 and it installs to a different path so thanks for pointing that out.

Also, you're right about the fact that somebody shouldn't be looking at the login scripts unless they know what they're doing. Only two of us have authority to modify the scripts so we keep it pretty secure.

I'll use the $HOMESERVER variable for the moment and will post a resolution if I find one.

Thanks again for the feedback.

Top
#46240 - 2003-10-02 02:51 AM Re: Windows 98 Environment Variable
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
My interpretation of the following phrase from the manual:

quote:
The environment of the current process (KiXtart 95) is not affected.
is SET, SETL, & SETM do not effect the DOS environment space that kixtart 'sees' locally.

I agree with NTDOC, in addition, I do not see how trying to write to a external variable space & then trying to read it back into the local space make things more understandable. In my opinion, this complicates the logic of the script.
_________________________
Jack

Top
#46241 - 2003-10-02 02:58 AM Re: Windows 98 Environment Variable
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
You are wrong about haw the environment gets set. In the KiXtart manual, it simply says:
quote:

The environment of the current process (KiXtart 2001) is not affected.

_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#46242 - 2003-10-02 03:00 AM Re: Windows 98 Environment Variable
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Damn that Jack... snuck in front of me. [Mad]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#46243 - 2003-10-02 03:29 AM Re: Windows 98 Environment Variable
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
I'm curious about that Parent Server key you are reading.

Is that some other non Corporate Edtion of SAV/NAV ?

For you Windows 9x systems you could also modify the Registry directly during logon if you want.

Maybe check the IP Range and set the Parent Server based on that.

You could also set parent server only and not download a GRC.DAT as they seem to sometimes be problematic.

Simply set the Parent during every logon.





$Parent='yourParentservername'
$RC=WRITEVALUE('\HKLM\SOFTWARE\INTEL\LANDesk\VirusProtect6\CurrentVersion', 'Parent', $Parent, 'REG_SZ')



Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 931 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.065 seconds in which 0.029 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org