Windows PowerShell Remote Runspace Pool 01 Sample
This sample shows how to construct a remote runspace pool and how to run multiple commands concurrently using this pool. Although commands can be run synchronously using runspace pools, typically runspace pools are used to run command concurrently.
Sample Objectives
This sample demonstrates the following:
- Creating a WSManConnectionInfo object.
- Creating a runspace pool that uses the WSManConnectionInfo object.
- Running the
Get-ProcessandGet-Servicecmdlets concurrently using the remote runspace pool. - Closing the runspace pool.
Related topics
Operating system requirements
Client
Windows 8.1
Server
Windows Server 2012 R2
Build the sample
-
Start Microsoft Visual Studio and select File > Open > Project/Solution.
-
Go to the directory named for the sample, and double-click the Visual Studio Solution (.sln) file.
-
Press F7 or use Build > Build Solution to build the sample.
The executable will be built in the default \bin or \bin\Debug directory.
Run the sample
- Verify that Windows PowerShell remoting is enabled. You can run the following command for additional information about how to enable this feature:
help about_remote. - Start the Command Prompt as Administrator.
- Navigate to the folder containing the sample executable.
- Run the executable.
- See the output results and the corresponding code.