3.6 Example 6: Create and Invoke a Pipeline

This example describes a typical sequence for creating and invoking a successful pipeline on the PowerShell server, with respect to the PSRP protocol[MS-PSRP], as described in section 2.5.2.8, and in the context of the system components, as described in section 2.1.4. A detailed description of each message follows.

Prerequisites

  • The RunspacePool is in an opened state on the PSRP client role.

Initial system state

None.

Final system state

The WM application created and invoked a pipeline on a PSRP server.

Sequence of events

The following diagram shows the communication flow for creating and invoking a pipeline.

Communication flow for creating and invoking a pipeline

Figure 14: Communication flow for creating and invoking a pipeline

The following steps describe this sequence of events.

  1. Request: The WM application sends a request through the component that implements the client role of the PSRP protocol. The request contains the necessary information and data which are implementation-specific.

  2. Request: The PSRP client role sends the request to the PSRP server role by using the wxf:Command message, as specified in [MS-PSRP] section 3.1.5.3.3.

  3. Response: The PSRP server role initializes the pipeline state to NotStarted, as specified in [MS-PSRP] section 3.2.1.3.2. The PowerShell server processes and validates the message and sends a success message if the validation is successful, as specified in [MS-PSRP] section 3.2.5.3.4.

  4. Execution: The PSRP server role changes the pipeline state to Running and starts executing the pipeline, as specified in [MS-PSRP] section 3.2.1.3.2.

  5. Request: The PSRP client role sends a wxf:Receive message, as specified in [MS-PSRP] section 3.2.5.3.7, to receive data from the pipeline on the PSRP server role.

  6. Response: After the pipeline execution is completed, the following occurs:

    • The PSRP server removes the entry for this pipeline in the RunspacePool's pending pipelines queue, as specified in [MS-PSRP] section 3.2.1.2.11.

    • The PSRP server changes the pipeline state to Completed, as specified in [MS-PSRP] section 3.2.1.3.2.

    • The PSRP server constructs the Completed PIPELINE_STATE message, as specified in [MS-PSRP] section 2.2.2.21, and sends it to the PSRP client by using the wxf:ReceiveResponse message, as specified in [MS-PSRP] section 3.2.5.3.8.

  7. Results: On receipt of the response from the server role, the PSRP client role delivers the response to the WM application.