The Win32_Environment class represents an environment or system environment setting on a Win32 computer system.

Quick Start


Most WMI properties are read-only. You can only read values but not change them. Few properties are also writeable. You can assign new values to those properties.

Writeable properties are marked with this icon:   


Data type String

The Caption property is a short textual description (one-line string) of the object.


Data type String

The Description property provides a textual description of the object.


Data type DateTime

The InstallDate property is datetime value indicating when the object was installed. A lack of a value does not indicate that the object is not installed.


Data type String

The Name property contains a character string specifying the name of a Win32 environment variable. By specifying the name of a variable that does not yet exist, an application can create a new environment variable.

Example: Path.


Data type String

The Status property is a string indicating the current status of the object. Various operational and non-operational statuses can be defined. Operational statuses are “OK”, “Degraded” and “Pred Fail”. “Pred Fail” indicates that an element may be functioning properly but predicting a failure in the near future. An example is a SMART-enabled hard drive. Non-operational statuses can also be specified. These are “Error”, “Starting”, “Stopping” and “Service”. The latter, “Service”, could apply during mirror-resilvering of a disk, reload of a user permissions list, or other administrative work. Not all such work is on-line, yet the managed element is neither “OK” nor in one of the other states.

'OK','Error','Degraded','Unknown','Pred Fail','Starting','Stopping','Service','Stressed','NonRecover','No Contact','Lost Comm'


Data type Boolean

The SystemVariable property indicates whether the variable is a system variable. A system variable is set by the operating system, and is independent from user environment settings.

Values: $true or $false. A value of $true indicates the variable is a system variable.


Data type String

The UserName property indicates the owner of the environment setting. It is set to “” for settings that are specific to the Win32 system (as opposed to a specific user) and “” for default user settings.

Example: Jsmith.


Data type String

The VariableValue property contains the placeholder variable of a Win32 environment variable. Information like the file system directory can change from machine to machine. The operating system substitutes placeholders for these.

Example: %SystemRoot%.



Help and Questions

  Community Content

You are cordially invited to add knowledge to this page. If you have sample code or additional information related to this WMI class, please share it. Use the comment form to send your information. We will edit and incorparate it into the reference library. Thank you!

Please do not use the comment form to submit questions. If you have questions or need assistance, visit our free forum: Help me with WMI.

Content last updated: 2013-12-27 12:21:58 (UTC).