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.
- Add System Environment variable through group policy
- Add User Environment variable through group policy
Steps to Add System Environment variable through GPO1. 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...
3. Type the new gpo name in the opened text box, and click OK.
4. Right-click on the newly created GPO, and click Edit.
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.
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
10. Click Add button, and Click the button Object Types in the opened dialog, and select Computers type and click OK
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.
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
Steps to Create User Environment variable through GPO1. 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
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.
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.
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