2.2.1 PowerShell Remoting Protocol Message
The structure of a PowerShell Remoting Protocol (PSRP) message is as follows.
|
|
|
|
|
|
|
|
|
|
1 |
|
|
|
|
|
|
|
|
|
2 |
|
|
|
|
|
|
|
|
|
3 |
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Destination |
|||||||||||||||||||||||||||||||
MessageType |
|||||||||||||||||||||||||||||||
RPID (16 bytes) |
|||||||||||||||||||||||||||||||
... |
|||||||||||||||||||||||||||||||
... |
|||||||||||||||||||||||||||||||
PID (16 bytes) |
|||||||||||||||||||||||||||||||
... |
|||||||||||||||||||||||||||||||
... |
|||||||||||||||||||||||||||||||
Data (variable) |
|||||||||||||||||||||||||||||||
... |
Destination (4 bytes): The destination of this message.
Possible values.
-
Value
Meaning
0x00000001
The message is targeted to a client.
0x00000002
The message is targeted to a server.
MessageType (4 bytes): The type of message. The value of this field specifies what action MUST be taken by the client or server upon receipt. Possible values are listed in the following table.
-
Value
Meaning
SESSION_CAPABILITY
0x00010002
Session capability.
Direction: Bidirectional (client to server or server to client).
Target: RunspacePool.
INIT_RUNSPACEPOOL
0x00010004
Initialize RunspacePool.
Direction: Client to server.
Target: RunspacePool.
PUBLIC_KEY
0x00010005
Public key.
Direction: Client to server.
Target: RunspacePool.
ENCRYPTED_SESSION_KEY
0x00010006
Encrypted session key.
Direction: Server to client.
Target: RunspacePool.
PUBLIC_KEY_REQUEST
0x00010007
Public key request.
Direction: Server to client.
Target: RunspacePool.
CONNECT_RUNSPACEPOOL
0x00010008
Connect to a RunspacePool.
Direction: Client to server.
Target: RunspacePool.
RUNSPACEPOOL_INIT_DATA
0x0002100B
RunspacePool initialization data.
Direction: Server to client.
Target: RunspacePool.
RESET_RUNSPACE_STATE
0x0002100C
Reset RunspacePool Runspace state.
Direction: Client to server.
Target: RunspacePool.
SET_MAX_RUNSPACES
0x00021002
Set maximum runspaces in a RunspacePool.
Direction: Client to server.
Target: RunspacePool.
SET_MIN_RUNSPACES
0x00021003
Set minimum runspaces in a RunspacePool.
Direction: Client to server.
Target: RunspacePool.
RUNSPACE_AVAILABILITY
0x00021004
A response to either set maximum runspaces or set minimum runspaces in a RunspacePool or request for available runspaces in a RunspacePool.
Direction: Server to client.
Target: RunspacePool.
RUNSPACEPOOL_STATE
0x00021005
State information of a RunspacePool.
Direction: Server to client.
Target: RunspacePool.
CREATE_PIPELINE
0x00021006
Create a command pipeline and invoke it in the specified RunspacePool.
Direction: Client to server.
Target: RunspacePool.
GET_AVAILABLE_RUNSPACES
0x00021007
Get the number of available runspaces in a RunspacePool.
Direction: Client to server.
Target: RunspacePool.
USER_EVENT
0x00021008
Report a user-defined event from a remote runspace.
Direction: Server to client.
Target: RunspacePool.
APPLICATION_PRIVATE_DATA
0x00021009
Application private data: data private to the application using the PowerShell Remoting Protocol on the server and client, which is passed by the protocol without interpretation.
Direction: Server to client.
Target: RunspacePool.
GET_COMMAND_METADATA
0x0002100A
Get command metadata for commands available in a RunspacePool.
Direction: Client to server.
Target: RunspacePool.
RUNSPACEPOOL_HOST_CALL
0x00021100
Method call on the host associated with the RunspacePool on the server.
Direction: Server to client.
Target: RunspacePool.
RUNSPACEPOOL_HOST_RESPONSE
0x00021101
Response from a host call executed on the client RunspacePool's host.
Direction: Client to server.
Target: RunspacePool.
PIPELINE_INPUT
0x00041002
Input to a command pipeline on the server.
Direction: Client to server.
Target: pipeline.
END_OF_PIPELINE_INPUT
0x00041003
Close the input collection for the command pipeline on the server.
Direction: Client to server.
Target: pipeline.
PIPELINE_OUTPUT
0x00041004
Output of a command pipeline on the server.
Direction: Server to client.
Target: pipeline.
ERROR_RECORD
0x00041005
Error record from a command pipeline on the server.
Direction: Server to client.
Target: pipeline.
PIPELINE_STATE
0x00041006
State information of a command pipeline on the server.
Direction: Server to client.
Target: pipeline or RunspacePool.
DEBUG_RECORD
0x00041007
Debug record from a command pipeline on the server.
Direction: Server to client.
Target: pipeline.
VERBOSE_RECORD
0x00041008
Verbose record from a command pipeline on the server.
Direction: Server to client.
Target: pipeline.
WARNING_RECORD
0x00041009
Warning record from a command pipeline on the server.
Direction: Server to client.
Target: pipeline.
PROGRESS_RECORD
0x00041010
Progress record from a command pipeline on the server.
Direction: Server to client.
Target: pipeline.
INFORMATION_RECORD
0x00041011
Information record from a command pipeline on the server.
Direction: Server to client.
Target: pipeline.
PIPELINE_HOST_CALL
0x00041100
Method call on the host associated with the pipeline invocation settings on the server.
Direction: Server to client.
Target: pipeline.
PIPELINE_HOST_RESPONSE
0x00041101
Response from a host call executed on the client's host.
Direction: Client to server.
Target: pipeline.
RPID (16 bytes): A globally unique identifier (GUID) specifying the instance ID of the RunspacePool on the client.
PID (16 bytes): A GUID specifying the instance ID of the pipeline on the client.
Data (variable): The contents of this field are determined by the MessageType field, and are fully specified in section 2.2.2.