Windows desktop applications
Collapse the table of content
Expand the table of content
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.

PowerShell.Runspace Property

 

Updated: April 27, 2016

Applies To: Windows PowerShell

Gets or sets the runspace that is used when the pipeline is invoked. The runspace is the operating environment that defines which commands, variables, and other elements are available. This property is introduced in Windows PowerShell 2.0.

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

public Runspace Runspace { get; set; }

Property Value

Type: System.Management.Automation.Runspaces.Runspace

A Runspace object that defines the runspace used when the pipeline is invoked. This property can be set to null, in which case a new runspace is created whenever the pipeline is invoked.

Exception Condition
InvalidPowerShellStateException

The PowerShell object cannot be changed in its current state.

ObjectDisposedException

The PowerShell object is disposed.

This property and the RunspacePool property are mutually exclusive; setting one of them resets the other to null.

To invoke the pipeline synchronously, call the Invoke method. To invoke the pipeline asynchronously, call the BeginInvoke method.

Return to top

Community Additions

Show:
© 2016 Microsoft