GetVariableValue Method (String, Object)
Collapse the table of content
Expand the table of content

PSCmdlet.GetVariableValue Method (String, Object)

 

Updated: April 27, 2016

Applies To: Windows PowerShell

Returns the value of a specific session-state variable or a default value if the variable does not exist.

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

public object GetVariableValue(
	string name,
	object defaultValue
)

Parameters

name
Type: System.String

The name of the session-state variable whose value is returned (scoped names are supported).

defaultValue
Type: System.Object

The default value returned if the variable does not exist.

Return Value

Type: System.Object

The value of the specified session-state variable or the supplied default value if the variable does not exist.

To get a variable value without supplying a default value, see the PSCmdlet.GetVariableValue method.

This method provides a shortcut to information that is also available through the SessionState class.

For more information about cmdlets, see Cmdlet Overview.

Return to top

Community Additions

ADD
Show:
© 2016 Microsoft