Skip to content

Latest commit

 

History

History
109 lines (86 loc) · 2.85 KB

File metadata and controls

109 lines (86 loc) · 2.85 KB

DSC Resource 'EnvironmentVariables'

EnvironmentVariables manages system and user environment variables.

When to use 'EnvironmentVariables'

Use this resource when you need to create, modify, or remove environment variables at the machine or user level. This is commonly needed for applications that rely on environment variables for configuration, such as Java (JAVA_HOME), build tools (PATH modifications), or custom application settings.

Source

DSC Resource

Documentation

Table 1. Attributes of category 'EnvironmentVariables'
Parameter Attribute DataType Description Allowed Values

Variables

Hashtable[]

Set of environment variables.

Table 2. Attributes of category 'EnvironmentVariables/Variables'
Parameter Attribute DataType Description Allowed Values

Name

Key

String

The name of the environment variable for which you want to ensure a specific state.

Value

String

The desired value for the environment variable.

The default value is an empty string which either indicates that the variable should be removed entirely or that the value does not matter when testing its existence. Multiple entries can be entered and separated by semicolons.

Ensure

String

Specifies if the environment variable should exist.

  • Present (default)

  • Absent

Path

Boolean

Indicates whether or not the environment variable is a path variable.

If the variable being configured is a path variable, the value provided will be appended to or removed from the existing value, otherwise the existing value will be replaced by the new value. When configured as a Path variable, multiple entries separated by semicolons are ensured to be either present or absent without affecting other Path entries.

  • True

  • False

Target

String[]

Indicates the target where the environment variable should be set.

  • Process

  • Machine

Example
EnvironmentVariables:
  Variables:
    - Name: var1
      Target: Machine
      Value: 123
    - Name: var2
      Target: Machine
      Value: 456