Remote Runspace Sample 01
This sample shows how to construct a remote runspace, set connection and operation timeouts, establish a remote connection, and close the connection.
For Windows PowerShell information on MSDN, see
This sample demonstrates the following:
- Creating an instance of the WSManConnectionInfo class.
- Setting OperationTimeout and OpenTimeOut using this WSManConnectionInfo instance.
- Using this WSManConnectionInfo instance to establish a remote connection.
- Closing the remote connection.
Sample Language Implementations
This sample is available in the following language implementations:
Building the Sample Using Visual Studio
- Open File Explorer and navigate to the RemoteRunspace01 directory under the samples directory.
- Double-click the icon for the .sln (solution) file to open the file in Visual Studio.
- In the Build menu, select Build Solution.
- The executable will be built in the default \bin or \bin\Debug directory.
Running the Sample
- Verify that Windows PowerShell remoting is enabled. You can run the 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.