Windows Dev Center

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.

Host05 Sample

This sample shows how to build an interactive console-based host application that reads commands from the command line, executes the commands, and then displays the results to the console. This host application also supports calls to remote computers by using the Enter-PsSession and Exit-PsSession cmdlets.

Requirements

  • This sample requires Windows PowerShell 2.0.

  • This application must be run in elevated mode (Run as administrator).

Demonstrates

Example

This example allows the user to enter commands at a command line, processes those commands, and then prints out the results.

The following code is the implementation of the PSHost class that is used by this host application. Those elements that are not implemented throw an exception or return nothing.

The following code is the implementation of the PSHostUserInterface class that is used by this host application.

The following code is the implementation of the PSHostRawUserInterface class that is used by this host application. Those elements that are not implemented throw an exception or return nothing.

See Also

Community Additions

Show:
© 2015 Microsoft