Compartir a través de


Configure an Environment Variable Item

Applies To: Windows Server 2008

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 and configure any options desired. (For more information, see Configure Common Options.)

  7. Click OK. The new preference item appears in the results 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. Applying this action to a segment of the PATH variable has no practical effect, other than potentially changing the text case of the segment. If the environment variable does not exist, then the Replace action creates a new environment variable.

Update

Modify settings of an existing environment variable. This action differs from Replace in that it only updates settings defined within the preference item. All other settings remain as configured on the environment variable. Applying this action to a segment of the PATH variable has no practical effect, other than potentially changing the text case of the segment. 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