Add Environment Variable via GPO

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.

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



5Expand 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

11Now 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.

Leave a Reply

Your email address will not be published. Required fields are marked *