Page 1 of 1 1
Topic Options
#118880 - 2004-04-30 09:01 PM NT/2000/XP env variable not set on first logon
ghuey Offline
Lurker

Registered: 2004-04-30
Posts: 3
Hey everyone.

Here is my problem, which only involves the NT family of OS's so any Win9x considerations can be ignored:

I have a simple login script that sets an environment variable required by an older DOS program that our company runs. Problem is that when a new user logs in for the FISRT time on a workstation these variables do not show up in the CMD environment. The second time they log in, and everytime thereafter they get the variable with no problem.

I am assuming this has something to do with their profile getting created that first time. I have used both SET and SETM neither of which resolve the issue, HOWEVER if you view the environment variables by looking at the properties of My Computer (vs. SET at cmd line) then those variable ARE listed, they just don't exist in the CMD environment yet. Not until the second login at least.

Hope the above makes sense.

Thanks for your help.


Top
#118881 - 2004-04-30 09:10 PM Re: NT/2000/XP env variable not set on first logon
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
ghuey,

Welcome to the board!

Can you post the code you are using right now? Otherwise, I think we will be guessing as to the specifics of what you are looking for.

If we look at the docs for SET/SETM, we see..
Quote:


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





You may do better for execution of your program at the time the script is run by using - SETL.

Thanks,

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

Top
#118882 - 2004-04-30 09:31 PM Re: NT/2000/XP env variable not set on first logon
ghuey Offline
Lurker

Registered: 2004-04-30
Posts: 3
The line of code is super basic

Code:

$OPNAME=Ucase(@USERID)
SET "OPNAME=$OPNAME"



Like I said, this works. Just not the first time they log in. Your comment about setting it to run at the application level is not a bad idea, however users do not have kix32 installed locally so I would need to do it in the batch file which would lead me to two more issues:

I don't believe Win9x systems support the %username% variable.
I would have to make sure the name was in all uppercase

Don't you just love legacy apps?

Top
#118883 - 2004-04-30 09:33 PM Re: NT/2000/XP env variable not set on first logon
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
So..

If I go to a command (CMD) Prompt, I see -

%USERNAME% as being kdyer

This is already being set by the OS. Do you have to have this in Upper Case?

Thanks,

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

Top
#118884 - 2004-04-30 09:40 PM Re: NT/2000/XP env variable not set on first logon
ghuey Offline
Lurker

Registered: 2004-04-30
Posts: 3
Let me just add a bit more.

You quote a line from the docs. I understand this as meaning that if I were to run a kixtart script that sets env variables and then were to immediatly run another program within this same environment that those variable would not be available. That makes sense, and is in fact what I am seeing. However, since the SET and SETM place entries in the HKCU and HKLM section of the registry then I would think that those variable would be available the next time I open a CMD session. They are not. Not immediately after someone logs in for the first time on a computer. The second time they are there however.

For instance:

Joe Newuser logs into XP system for first time.
Kixtart login script runs.
opname variable is set to NEWUSERJ in HKCU
login script exists.
Joe is sitting at a brand new desktop
Joe launches "DOS" program, but program fails bc no opname exists.
Joe logs out.
Joe logs back in.
Now he can run the "DOS" program.

Due to some poor programming the opname value MUST be in uppercase, AND I have to contend with Win9x limitations if I DON'T utilize Kixtart.

Top
#118885 - 2004-05-01 09:10 PM Re: NT/2000/XP env variable not set on first logon
kholm Offline
Korg Regular
*****

Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
If you are using Active Directory,

Try setting the value: "Run logon scripts syncronously" to enabled

The value is found in:
Compute configuration + Administrative Templates + System + Scripts


I believe your problem comes from the Explorer is started before your longonscript runs. (Win2k and XP)


Alternatively, you could try to activate the desktop and press funntionkey F5

-Erik

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 1046 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.055 seconds in which 0.024 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