add environment variable via group policy

  • Thread starter Thread starter jonesy
  • Start date Start date
J

jonesy

I want to add an environment variable to all members of a security
group - is it possible to do this using group policy, and what other
methods are able to be used?
 
Hi jones,

Have you tried to put that in the logon script of the affected user
accounts?

br,
Denis
 
Hi,
Have you tried to put that in the logon script of
the affected user accounts?

Doesn´t work with "set", because this setting is only effective
to the opened cmd.

setx can do this globally
http://www.microsoft.com/windows2000/techinfo/reskit/tools/existing/setx-o.asp

Another possibility is to set the variable via ADM Template, if
it is not dynamic, like a IP can be ...

---- environment.adm ----
; http://www.gruppenrichtlinien.de/adm/temp.txt
; you have to edit policy, part and valuename
; you can extend the ADM by adding further parts

CLASS USER

CATEGORY "Userspecific Environment Variables (SET)"
POLICY "Rename it to your settings ..."
KEYNAME "Environment"
PART "Set Name of your var =" EDITTEXT
VALUENAME NameofyourVar
END PART
END POLICY

END CATEGORY
---- environment.adm ----

HTH
Mark
 
I have a script that can be run to add the variable, but it will only
add the user variable if I put the account name. The script looks like
this;

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\cimv2")

Set objVariable = objWMIService.Get("Win32_Environment").SpawnInstance_

objVariable.Name = "TEST"
objVariable.UserName = "DOMAIN\USERNAME"
objVariable.VariableValue = "This is a test"
objVariable.Put_

If I actually put the domain and user name in, it works and adds the
variable, but I need to be able to convert it into an MSI file and
deploy it to various machines. I have tried Domain/%username% but that
does not work. Is there another string that I can put there that adds
it to the user who is logged in?
 
Hi,
I have a script that can be run to add the variable, but it will only
add the user variable if I put the account name. The script looks like
this; [...]
objVariable.Name = "TEST"
objVariable.UserName = "DOMAIN\USERNAME"
objVariable.VariableValue = "This is a test"
objVariable.Put_

I don´t get it ... must be a reason of very less VB knowledge ;-)
What is the name of variable you want to define, with the
value "This is the test"?

Mark
 
Back
Top