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.CreateRunspacePool Method

 

Updated: April 27, 2016

Applies To: Windows PowerShell

Creates a pool of runspaces. The variants of this method can be used to create a pool that contains a single runspace, a pool that specifies the minimum and maximum number of runspaces that can be open, and more. This method is introduced in Windows PowerShell 2.0.

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

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticCreateRunspacePool()

Creates a runspace pool that contains a single runspace. This runspace uses the default host and default runspace configuration. This method is introduced in Windows PowerShell 2.0.

System_CAPS_pubmethodSystem_CAPS_staticCreateRunspacePool(InitialSessionState)

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.

System_CAPS_pubmethodSystem_CAPS_staticCreateRunspacePool(Int32, Int32)

Creates a pool of runspaces that specifies the minimum and maximum number of opened runspaces for the pool. This method is introduced in Windows PowerShell 2.0.

System_CAPS_pubmethodSystem_CAPS_staticCreateRunspacePool(Int32, Int32, InitialSessionState, PSHost)

Creates a runspace pool that specifies minimum and maximum number of opened runspaces, and a custom host and initial session state information that is used by each runspace in the pool. This method is introduced in Windows PowerShell 2.0.

System_CAPS_pubmethodSystem_CAPS_staticCreateRunspacePool(Int32, Int32, PSHost)

Creates a pool of runspaces that specifies the minimum and maximum number of opened runspaces for the pool, and a custom host that is used by each runspace. This method is introduced in Windows PowerShell 2.0.

System_CAPS_pubmethodSystem_CAPS_staticCreateRunspacePool(Int32, Int32, RunspaceConnectionInfo)

Creates a runspace pool that contains runspaces that can be opened on a remote computer. The runspace pool specifies the minimum number of runspaces that Windows PowerShell maintains open, the maximum number of runspaces in the pool, and the connection information used to connect to a computer. This method is introduced in Windows PowerShell 2.0.

System_CAPS_pubmethodSystem_CAPS_staticCreateRunspacePool(Int32, Int32, RunspaceConnectionInfo, PSHost)

Creates a runspace pool that contains runspaces that can be opened on a remote computer. The runspace pool specifies the minimum number of runspaces that Windows PowerShell maintains open, the maximum number of runspaces in the pool, a custom host, and the connection information used to connect to a computer. This method is introduced in Windows PowerShell 2.0.

System_CAPS_pubmethodSystem_CAPS_staticCreateRunspacePool(Int32, Int32, RunspaceConnectionInfo, PSHost, TypeTable)

Creates a runspace pool that contains runspaces that can be opened on a remote computer. The runspace pool specifies the minimum number of runspaces that Windows PowerShell maintains open, the maximum number of runspaces in the pool, a custom host, connection information, and type table information used for serialization. This method is introduced in Windows PowerShell 2.0.

System_CAPS_pubmethodSystem_CAPS_staticCreateRunspacePool(Int32, Int32, RunspaceConnectionInfo, PSHost, TypeTable, PSPrimitiveDictionary)

Creates a runspace pool that contains runspaces that can be opened on a remote computer. The runspace pool specifies the minimum number of runspaces that Windows PowerShell maintains open, the maximum number of runspaces in the pool, a custom host, connection information, type table (serialization) information, and endpoint application arguments. This method is introduced in Windows PowerShell 2.0.

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 that 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.

A Windows PowerShell 2.0 example. The following example shows how to create a runspace pool and open a runspace from the pool synchronously.

// Using the RunspaceFactory and RunspacePool objects, 
// create the runspace pool and open a runspace.
RunspacePool rsp = RunspaceFactory.CreateRunspacePool();
rsp.Open();

Return to top

Community Additions

Show: