add environment variable via group policy

Jonesy

Distinguished
Apr 21, 2004
17
0
18,510
Archived from groups: microsoft.public.win2000.group_policy (More info?)

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?
 

Jonesy

Distinguished
Apr 21, 2004
17
0
18,510
Archived from groups: microsoft.public.win2000.group_policy (More info?)

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?
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.group_policy (More info?)

Hi jones,

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

br,
Denis

"jonesy" <stevenjones_6@hotmail.com> wrote in message
news:1125972625.643466.127870@g47g2000cwa.googlegroups.com...
> 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?
>
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.group_policy (More info?)

Hi,

Denis Wong @ Hong Kong schrieb:
> 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
--
Mark Heitbrink - MVP Windows Server
Homepage: www.gruppenrichtlinien.de
W2K FAQ : http://w2k-faq.ebend.de
PM: Vorname@Homepage, Versende-Adresse wird nicht abgerufen.
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.group_policy (More info?)

Hi,

jonesy schrieb:
> 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
--
Mark Heitbrink - MVP Windows Server
Homepage: www.gruppenrichtlinien.de
W2K FAQ : http://w2k-faq.ebend.de
PM: Vorname@Homepage, Versende-Adresse wird nicht abgerufen.