RunspaceFactory.CreateRunspacePool Method (Int32, Int32, PSHost)
Updated: April 27, 2016
Applies To: Windows PowerShell
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.
Assembly: System.Management.Automation (in System.Management.Automation.dll)
public static RunspacePool CreateRunspacePool( int minRunspaces, int maxRunspaces, PSHost host )
The minimum number of opened runspaces that Windows PowerShell maintains open even if the runspaces of the pool are no longer needed (default is one). Typically, Windows PowerShell destroys opened runspaces when they are no longer needed.
The maximum number of runspaces that are allowed to be open at the same time. Set to a value greater than the minRunspaces parameter.
Return ValueType: System.Management.Automation.Runspaces.RunspacePool
Returns a RunspacePool object that represents the pool with the maximum and minimum number of opened runspaces, and a custom host. When a runspace from the pool is opened, the runspace uses the custom host.
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: