Add Environment Variable via Group Policy

Description

In this article I am going to explain about how to Create or Add System Environment variable and User Environment variable via Group Policy.

Summary

  1. Add System Environment variable through group policy
  2. Add User Environment variable through group policy

Steps to Add System Environment variable through GPO

1. Open the Group Policy Management Console by running the command gpmc.msc


2. Expand the domain node,  Right-Click on the OU that contains computer objects which you are going to add Environment variable and click Create a GPO in this domain, and Link it here…

Add Environment Variable via GPO

3. Type the new gpo name in the opened text box, and click OK.

Add Environment Variable via GPO

4. Right-click on the newly created GPO, and click Edit.

Add Environment Variable via Group Policy

5. Expand the Computer Configuration and got to the node Environment (Computer Configuration->Preferences->Windows Settings->Environment).


6. Right-click on the node Environment, click New->Environment Variable.


7. Ensure that the radio button System Variable is checked, fill the text box values for Name and Value, and click Apply.

Add Environment Variable through Group Policy

8. Now, you have created new Environment variable using GPO for the computers which are inside the OU Testing Computers. You can also limit the scope of this Environment Variable by Security Filtering.

9. Click on the tab Scope,  go to the section Security Filtering, now Remove the Authenticated Users entry

Add Environment Variable through Group Policy

10. Click Add button, and Click the button Object Types in the opened dialog, and select Computers type and click OK

Add Environment Variable through Group Policy

11. Now select the computer which you want add Environment variables through this GPO, and click OK. In this way you can add computers one-by-one to apply this gpo.

Add Environment Variable through GPO

12. Now you have successfully created the Environment Variable using Group Policy, to see the value, update the GPO by running the command GPUpdate/Force.


13. Logoff the machine and Login again to see newly created Environment Variable

14. Run the command set SystemType to check the newly created Environment Variable

Add User Environment Variable through GPO

Steps to Create User Environment variable through GPO

1. Create the new GPO and link it the OU that contains the users which you are going to add new Environment Variable.

2. Right-Click on the GPO, and click Edit

3. Expand  User Configuration, and go to the node User Configuration ->Preference ->Windows Settings ->Environment. Right-Click on the node Environment, and Click New->Environment Variable.

4. Ensure the radio button User variable is checked, fill the values for Name and Value, and Click Apply

Set Environment Variable through Group Polciy

5. You can also limit the scope of this policy to the users only who are in the Security group TestingTeam by removing the Authenticated Users Entry in Security Filtering, and add the group TestingTeam.

Add Environment Variable through GPO

6. Now you have successfully created the User Environment Variable using Group Policy, to see the value, update the GPO by running the command GPUpdate/Force.

7. Logoff the machine and Login again to see the newly created Environment Variable.

Now, you have successfully created the GPO to Create Environment Variable via Group Policy

Note : This article is applies to Windows Server 2003, Windows Server 2008,Windows Server 2008 R2, Windows Server 2012, Windows 7 and Windows 8.

Related Articles

How to Pin a Program to Start menu via Group Policy
– Create Folder on Desktop via GPO
– Pin Program to Taskbar via Group Policy
– Add desktop shortcut icon through Group Policy
– Add start menu shortcut via Group Policy

Advertisement

9 thoughts on “Add Environment Variable via Group Policy”

  1. Hi my family member! I wish to say that this article is awesome,
    nice written and include approximately all significant infos.

    I'd like to look extra posts like this .

    my page: Asian Massage ()

    Reply
  2. Thx for this article !
    But I have an issue, I create a user variable and when I logon again & goes to the Environment Variable panel I can't see my user variable … any idea why ?

    Reply
    • Hi friend, have you updated the GPO by gpupdate command?…if you already did, please restart the machine and check through command prompt using "Set" command.

      Reply
  3. Hello morgan , i have created the gpo on the domain server which updates an environment variable. where do i need to run gpupdate and logon/logoff? on the server or client pc?

    Reply

Leave a Comment