Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

PSVariable Class

Definition

Namespace:
System.Management.Automation
Assembly:
System.Management.Automation.dll
Package:
Microsoft.PowerShell.5.1.ReferenceAssemblies v1.0.0
Package:
System.Management.Automation v7.4.15
Package:
System.Management.Automation v7.5.6
Package:
System.Management.Automation v7.6.1

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Represents a variable in the PowerShell language.

public ref class PSVariable
public class PSVariable
type PSVariable = class
Public Class PSVariable
Inheritance
PSVariable

Constructors

Name Description
PSVariable(String, Object, ScopedItemOptions, Collection<Attribute>)

Constructs a variable with the given name, value, options, and attributes.

PSVariable(String, Object, ScopedItemOptions)

Constructs a variable with the given name, value, and options.

PSVariable(String, Object)

Constructs a variable with the given name, and value.

PSVariable(String)

Constructs a variable with the given name.

Properties

Name Description
Attributes

Gets the collection that contains the attributes for the variable.

Description

Gets or sets the description of the variable.

Module

The module where this variable was defined.

ModuleName

The name of the module that defined this variable.

Name

Gets the name of the variable.

Options

Gets or sets the scope options on the variable.

Value

Gets or sets the value of the variable.

Visibility

If true, then this variable is visible outside the runspace.

Methods

Name Description
IsValidValue(Object)

Checks if the given value meets the validation attribute constraints on the PSVariable.

Applies to