A runspace provides a mechanism for hosting applications to execute pipelines programmatically in a well-constructed manner. Looked at in another way, a runspace created by a hosting application is an abstraction of the Windows PowerShell runtime that is used by the default hosting application Powershell.exe.
Runspaces construct a logical model of execution using pipelines that contain cmdlets, native commands, and language elements, which in turn ensures that the hosting application and its user do not need to know about the underlying execution of the cmdlets required to perform a task.
Communications
However, even though the runspace separates the hosting application from the pipeline execution, communications between the hosting application user and the underlying pipeline execution may occur in two ways. First, the execution may return results that may be displayed by the hosting application. Second, the elements of the pipeline may communicate directly with the host through one of two optional host interfaces that can be specified when the runspace is configured.
Creating a Runspace
See Also