I'm attempting to set an environment variable (without using the System control panel) so that every user who logs on has it set. This is on a Win2K server SP4 running standalone (no clients). My login vbs script is something akin to:
I added the vbs to the local group policy. No other group policy login scripts (domain, etc.) are defined.
When I login, either as admin or as a "mortal" user, the script runs fine -- I get the expected wscript popup displaying the echoed value. So far, so good.
The problem occurs when I open a new command prompt window and do a "set" command. I would expect to see my environment variable listed. But that's not always the case. If I've logged on as admin, it's there nearly every time, but not always. If I've logged on as a "mortal" user, it's there some of the time, perhaps one in five logons, with better chance of success right after a boot.
Seems strange to me -- I was hoping for better reliability than this. Timing problem, perhaps? Faulty assumption?
GD
Code:
Dim shell
Dim volEnv
Set shell = Wscript.CreateObject("Wscript.Shell")
Set volEnv = shell.Environment("VOLATILE")
volEnv("TEST_VOLATILE") = "test_value"
Wscript.echo volEnv("TEST_VOLATILE")
When I login, either as admin or as a "mortal" user, the script runs fine -- I get the expected wscript popup displaying the echoed value. So far, so good.
The problem occurs when I open a new command prompt window and do a "set" command. I would expect to see my environment variable listed. But that's not always the case. If I've logged on as admin, it's there nearly every time, but not always. If I've logged on as a "mortal" user, it's there some of the time, perhaps one in five logons, with better chance of success right after a boot.
Seems strange to me -- I was hoping for better reliability than this. Timing problem, perhaps? Faulty assumption?
GD