Update --- User Environment variables ... a more precise description of the problem

  • Thread starter Thread starter Houman Yahyaei
  • Start date Start date
H

Houman Yahyaei

Hi guys, I posted in the VB Script group several times about a problem that
I had with a script that would set environment variables, but it finally
seems that it's not a script problem...

If I run the script as a normal Logon script on user's account, it works,
but if I run the logon script from a GPO... no good...
The script runs, the variables are set in the registry and visible trough
the user's environment variable window in My
computer\properties\advanced\Environment variable...

But if I go to a cmd and type set... the variables are not known here... If
I go back to the environment variables windows and say ok, the variables
then become available when doing a cmd \ set


Any one has an idea why ???

Thanks !!!



Here is the original post :

*************
need to reload user environment variables after a script is run...
The script adds user environment variables, and they appear to be there, but
not loaded into the system...

I have tried : "%windir%\System32\RUNDLL32.EXE
user32.dll,UpdatePerUserSystemParameters", _
1, True

But it doesn't seem to work...

Can anyone help me...
Or another way, is there a way to open up environment variables windows and
say OK to it within a script ( invisibly I guess )...
Because when this is done manually, it works very well..
****
Thanks !!!

--
 
Well, the script is a logon script, but on a OU with computers only... (
Since it has to run only when users are connecting to these particular TS
servers ( We have turn on the GPO Loopback Processing mode )...

Here is an example of the script :

Set WshShell = CreateObject("WScript.Shell")

Set WshSysEnv = WshShell.Environment("USER")

WshSysEnv("x3-logon-UserVar") = "x33-test-user-val-logon"

Thanks !!!


--
 
Yes it runs, tested with GPMC and GPResult and see every other part of
script working perfectly... as I have stated.. the environment variables
are visible trough the properties of my computer \ advanced, environment
variables... it's just that when going to a command prompt and doing "set",
the variables aren't there...

If I go back to the environment variable window in my computer's properties,
and click OK, they are added...


--
 
Back
Top