Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

SessionStateVariableEntry Class

 

Updated: April 27, 2016

Applies To: Windows PowerShell

Defines a variable for an initial session state configuration. The initial session state of a runspace defines the elements, such as variables, that are available when the runspace is opened. This class is introduced in Windows PowerShell 2.0.

Namespace:   System.Management.Automation.Runspaces
Assembly:  System.Management.Automation (in System.Management.Automation.dll)


public sealed class SessionStateVariableEntry : ConstrainedSessionStateEntry

NameDescription
System_CAPS_pubmethodSessionStateVariableEntry(String, Object, String)

Creates a new SessionStateVariableEntry object that contains the name, value, and description of the variable. This constructor is introduced by Windows PowerShell 2.0.

System_CAPS_pubmethodSessionStateVariableEntry(String, Object, String, ScopedItemOptions)

Creates a new SessionStateVariableEntry object that contains the name, value, description, and usage options for the variable. This constructor is introduced by Windows PowerShell 2.0.

System_CAPS_pubmethodSessionStateVariableEntry(String, Object, String, ScopedItemOptions, Attribute)

Creates a new SessionStateVariableEntry object that contains the name, value, description, usage options, and a single metadata attribute of the variable. This constructor is introduced by Windows PowerShell 2.0.

System_CAPS_pubmethodSessionStateVariableEntry(String, Object, String, ScopedItemOptions, Collection<Attribute>)

Creates a new SessionStateVariableEntry object that contains the name, value, description, usage options, and metadata attribute of the variable. This constructor is introduced by Windows PowerShell 2.0.

NameDescription
System_CAPS_pubpropertyAttributes

Gets the attributes that define the metadata of the variable. This property is introduced in Windows PowerShell 2.0.

System_CAPS_pubpropertyDescription

Gets the description of the variable. This property is introduced in Windows PowerShell 2.0.

System_CAPS_pubpropertyModule

Gets information about the module defined by this session state entry. This property is introduced in Windows PowerShell 2.0.(Inherited from InitialSessionStateEntry.)

System_CAPS_pubpropertyName

Gets the name of the entry for the derived class. This property is introduced in Windows PowerShell 2.0.(Inherited from InitialSessionStateEntry.)

System_CAPS_pubpropertyOptions

Gets the usage options of the variable. This property is introduced in Windows PowerShell 2.0.

System_CAPS_pubpropertyPSSnapIn

Gets information about the snap-in defined by the session state entry. This property is introduced in Windows PowerShell 2.0.(Inherited from InitialSessionStateEntry.)

System_CAPS_pubpropertyValue

Gets the value assigned to the variable when the runspace is opened. This property is introduced in Windows PowerShell 2.0.

System_CAPS_pubpropertyVisibility

Gets and sets a Boolean value that indicates whether the session state entry is public or private. This property is introduced in Windows PowerShell 2.0.(Inherited from ConstrainedSessionStateEntry.)

NameDescription
System_CAPS_pubmethodClone()

Creates an exact copy of the variable entry. This method is introduced in Windows PowerShell 2.0.(Overrides InitialSessionStateEntry.Clone().)

System_CAPS_pubmethodEquals(Object)

(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

(Inherited from Object.)

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_pubmethodToString()

(Inherited from Object.)

A variable entry is added to the initial session state through the InitialSessionStateEntryCollection<T> object associated with the InitialSessionState.Variables property.

This class cannot be inherited.

A Windows PowerShell 2.0 example. The following example shows how to add two variables to the initial session state.

// Using an InitialSessionState object, create the 
// default initial session state, define variables
// test1 and test2, and add them to the initial session state.
InitialSessionState iss = InitialSessionState.CreateDefault();
SessionStateVariableEntry var1 = new 
    SessionStateVariableEntry("test1",
                              "MyVar1",
                              "Initial session state test");
SessionStateVariableEntry var2 = new 
    SessionStateVariableEntry("test2",
                              "MyVar2",
                              "Initial session state test");
iss.Variables.Add(var1);
iss.Variables.Add(var2);

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: