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.

RunspaceFactory.CreateRunspace Method (PSHost)

 

Updated: April 27, 2016

Applies To: Windows PowerShell

Creates a single runspace that uses a custom host.

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

public static Runspace CreateRunspace(
	PSHost host
)

Parameters

host
Type: System.Management.Automation.Host.PSHost

A PSHost object that represents the host. A host is used to interact or communicate directly with the user through prompting.

Return Value

Type: System.Management.Automation.Runspaces.Runspace

Returns a Runspace object that represents the runspace. When the runspace is opened, the host defines how the invoked commands are handled by Windows PowerShell.

A runspace is the operating environment used when invoking the commands of a pipeline. After the runspace is created, it must be opened by using one of the following methods before it can be used:

  • To open the runspace synchronously, call the Open method.

  • To open the runspace asynchronously, call the OpenAsync method.

When using the default host, there is no way to interact or communicate directly with the user through prompting.

Return to top

Community Additions

Show: