4.1.11 Getting the Metadata of Remote Commands

The typical PSRP sequence for getting the metadata of commands available on the server is shown in the following table:

Step

Client

Direction

Server

1

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

The client constructs a GET_COMMAND_METADATA message (section 2.2.2.14).

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

The client initializes the pipeline state (section 3.1.1.3.2) to Running.

The client sends the first fragment to the server using the wxf:Command message (section 3.1.5.3.3).

>

The server extracts the RPID and PID from the message (section 2.2.1) and uses the same values while sending responses to the client.

2

<

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

3

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

>

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

The server validates the GET_COMMAND_METADATA message (section 3.2.5.4.14).

4

The server collects the available commands metadata in the RunspacePool from the higher layer. While interacting with the higher layer, the server extracts the extended properties Name, CommandType, Namespace and ArgumentList from the GET_COMMAND_METADATA message (section 2.2.2.14) message and passes them to the higher layer. The higher layer interprets the values of these properties as per the guidelines specified in section 2.2.2.14.

5

The client sends a wxf:Receive message to start receiving data from the server.

>

6

<

Once all the commands metadata is collected, the server first constructs a CommandMetadataCount (section 2.2.3.21) object using the collected number of commands metadata and sends it to the client.

For each and every command metadata collected, the server constructs a CommandMetadata (section 2.2.3.22) object and sends it to the client.

7

The client sends a wxf:Receive message to start receiving data from the server.

This step is repeated until server indicates that the Getting command metadata is completed (step 8).

>

8

<

Once all CommandMetadata (see section 2.2.3.22) objects have been sent, the server sends the Completed PIPELINE_STATE message (section 3.2.5.4.21).

9

The client changes the pipeline state (section 3.1.1.3.2) to Completed and notifies the higher layer.