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.CreateRunspacePool Method (InitialSessionState)


Updated: April 27, 2016

Applies To: Windows PowerShell

Creates a pool of runspaces that use the specified initial session state. The initial session state defines the elements, such as cmdlets, scripts, and variables that are accessible within the runspace. This method is introduced in Windows PowerShell 2.0.

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

public static RunspacePool CreateRunspacePool(
	InitialSessionState initialSessionState


Type: System.Management.Automation.Runspaces.InitialSessionState

An InitialSessionState object that defines the session state configuration when the runspace is opened.

Return Value

Type: System.Management.Automation.Runspaces.RunspacePool

Returns a RunspacePool object that represents the pool whose runspaces use the specified initial session state.

A runspace pool is a set of runspaces that have the same features, such as the same host, initial session state, and connection information. A runspace from the pool is the operating environment used when invoking the commands of a pipeline. After the runspace pool is created, a runspace from the pool must be opened by using one of the following methods before it can be used:

  • To open a runspace from the pool synchronously, call the Open method.

  • To open a runspace from the pool asynchronously, call the BeginOpen method.

Return to top

Community Additions