4.1.3 Creating and Invoking a Pipeline

The typical PSRP sequence for creating and invoking a successful pipeline on the server is shown in the following table:






The RunspacePool is in the Opened state on the client (section 4.1.1).

The client constructs a CREATE_PIPELINE message (section

The client fragments the message into multiple fragments as needed (section 2.2.4).

The client initializes the pipeline state (section to Running.

The client sends the first fragment to the server using a wxf:Command message (section


The server extracts the PID from the message (section 2.2.1) and stores this value as the pipeline's GUID (section

The server initializes the pipeline state (section to NotStarted.

The server processes and validates the message.



The server sends a success message (section if validation is successful.


If the pipeline message is fragmented into multiple fragments, the rest of the fragments (starting from second fragment) are sent individually using a wxf:Send message (section



The server collects all the fragments until the end fragment (section 2.2.4) is received.

For each wxf:Send message received from the client, the server sends a wxf:SendResponse message (see section to the client.

The server processes all the fragments and understands the pipeline to execute.

If a runspace in the RunspacePool is available (section, the RunspacePool assigns the runspace to the pipeline for execution.



The server changes the pipeline state (section to Running.

Note this state change information is not sent to the client.

The server starts executing the pipeline.


The client sends a wxf:Receive message to start receiving data from the pipeline on the server. After each received wxf:ReceiveResponse message (see section, the client sends another wxf:Receive message until the server indicates that the pipeline is completed (step 8). Sending of input (steps 6 and 7) can happen in parallel.



The server sends the pipeline result messages (if any): PIPELINE_OUTPUT (section, ERROR_RECORD (section, DEBUG_RECORD (section, VERBOSE_RECORD (section, WARNING_RECORD (section, PROGRESS_RECORD (section, and INFORMATION_RECORD (section using wxf:ReceiveResponse (section


The client can send any PIPELINE_INPUT messages (section to the pipeline using a                                                                                                                                      wxf:Send message (section if the CREATE_PIPELINE message indicated that the pipeline takes input.


The server processes the message and dispatches the input to pipeline execution.


If the CREATE_PIPELINE message indicated that the pipeline takes input, the client sends an END_OF_PIPELINE_INPUT message (section using a wxf:Send message (section after sending all (possibly zero) the PIPELINE_INPUT messages to the server.


The server processes the END_OF_PIPELINE_INPUT message and notifies the pipeline execution that no more input is expected.



After the pipeline execution is complete:

  • The server removes the entry for this pipeline in the RunspacePool's pending pipelines queue (section

  • The server changes the pipeline state (section to Completed.

  • The server constructs the Completed PIPELINE_STATE message (section and sends it to the client using wxf:ReceiveResponse (section


The client changes the pipeline state (section to Completed.