RunspaceFactory.CreateRunspace Method (PSHost, RunspaceConfiguration)

Creates a single runspace that uses a custom host and runspace configuration information.


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

'Usage
Dim host As PSHost
Dim runspaceConfiguration As RunspaceConfiguration
Dim returnValue As Runspace

returnValue = RunspaceFactory.CreateRunspace(host, runspaceConfiguration)

public static Runspace CreateRunspace (
	PSHost host,
	RunspaceConfiguration runspaceConfiguration
)
public static Runspace CreateRunspace (
	PSHost host, 
	RunspaceConfiguration runspaceConfiguration
)
public static function CreateRunspace (
	host : PSHost, 
	runspaceConfiguration : RunspaceConfiguration
) : Runspace

Parameters

host

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

runspaceConfiguration

A RunspaceConfiguration object that represents the configuration of the runspace. The runspace configuration describes the cmdlets, providers, and startup scripts that can be accessed within the runspace.

Return Value

Returns a Runspace object that represents the runspace. When the runspace is opened, the specified host is used to define how the invoked commands are handled by Windows PowerShell, and the runspace configuration is used to define the elements, such as cmdlets and providers, that are accessible to the runspace.

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.


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

 

Target Platforms


Show:
© 2015 Microsoft