Configure an Environment Variable Item

Applies To: Windows 8, Windows Server 2008 R2, Windows Server 2012

Environment Variable preference items allow you to create, update, replace, and delete user and system environment variables or semicolon-delimited segments of the PATH variable. Before you create an Environment Variable preference item, you should review the behavior of each type of action possible with this extension.

Creating an Environment Variable item

To create a new Environment Variable preference item

  1. Open the Group Policy Management Console . Right-click the Group Policy object (GPO) that should contain the new preference item, and then click Edit .

  2. In the console tree under Computer Configuration or User Configuration , expand the Preferences folder, and then expand the Windows Settings folder.

  3. Right-click the Environment node, point to New , and select Environment Variable .

  4. In the New Environment Variable Properties dialog box, select an Action for Group Policy to perform. (For more information, see "Actions" in this topic.)

  5. Enter environment variable settings for Group Policy to configure or remove. (For more information, see "Environment variable settings" in this topic.)

  6. Click the Common tab, configure any options, and then type your comments in the Description box. (For more information, see Configure Common Options.)

  7. Click OK . The new preference item appears in the details pane.

Actions

This type of preference item provides a choice of four actions: Create , Replace , Update , and Delete . The behavior of the preference item varies with the action selected and whether the environment variable already exists.

Create

Create a new environment variable or to add a semicolon-delimited segment to the PATH variable for computers or users.

Delete

Remove an environment variable or to delete a semicolon-delimited segment from the PATH variable from computers or users.

Replace

Delete and recreate an environment variable. The net result of the Replace action is to overwrite all existing settings associated with the environment variable.

A separate option to specify the PATH system variable is available. The PATH variable contains a list of semicolon delimited folder paths that Windows uses when locating files. Replace will replace the specified part of the PATH variable. This will have no net effect on the path with the possible exception of changing the text case of the specified segment. Multiple segments are not supported by this option.

If the environment variable does not exist, then the Replace action creates a new environment variable.

Update

Delete and recreate settings of an existing environment variable. This action is the same as Replace in that it overwrites the existing variable value associated with the environment variable.

A separate option to specify the PATH system variable is available. The PATH variable contains a list of semicolon delimited folder paths that Windows uses when locating files. Update will replace the specified part of the PATH variable. This will have no net effect on the path with the possible exception of changing the text case of the specified segment. Multiple segments are not supported by this option.

If the environment variable does not exist, then the Update action creates a new environment variable.

Environment variable settings

User Variable

To cause the environment variable to affect each user independently, select this setting for an Environment preference item under User Configuration . The environment variable is stored in the registry in HKEY_CURRENT_USER.

To cause the environment variable to affect only the default user of the computer, select this setting for an Environment preference item under Computer Configuration .

System Variable

To cause the environment variable to affect all users of the computer, select this setting. The environment variable is stored in the registry in HKEY_LOCAL_MACHINE.

Name

Type a name for the environment variable to which the action is applied. To select the PATH variable, leave this field blank.

PATH

To create or replace the value of the PATH variable or to add or delete a semicolon-delimited segment of the value of the PATH variable, select this check box. This option is available only when System Variable is selected.

Partial

To add or delete a semicolon-delimited segment of the value of the PATH variable, select this check box. This option is available only when System Variable and PATH are selected.

Value

Type the value for the environment variable. This field accepts variables.

If PATH is selected, type a semicolon-delimited list of folder paths for Windows to use to find files.

If Partial is selected, type one segment of the PATH variable, omitting the semicolon delimiter.

Additional considerations

  • If you want to restrict the scope of multiple preference items with a complex set of targeting items, you can simplify configuration by using an environment variable. For example, create an Environment Variable preference item that generates a new environment variable with a value of 1, and apply the targeting items to it. To apply the same targeting to other preference items, add an Environment Variable targeting item to those preference items, and configure it to require a value of 1 for the variable that you created using an Environment Variable preference item.

  • You can use item-level targeting to change the scope of preference items.

  • Preference items are available only in domain-based GPOs.

Additional references