Revision Summary Date Revision History Revision Class Comments 12/5/2008 0.1 Major Initial Availability 1/16/2009 1.0 Updated and revised the technical content. 2/27/2009 1.0.1 Editorial Changed language and formatting in the technical content. 4/10/2009 2.0 Updated and revised the technical content. 5/22/2009 3.0 Major Updated and revised the technical content. 7/2/2009 4.0 Updated and revised the technical content. 8/14/2009 5.0 Major Updated and revised the technical content. 9/25/2009 6.0 Major Updated and revised the technical content. 11/6/2009 7.0 Major Updated and revised the technical content. 12/18/2009 8.0 Updated and revised the technical content.
1/29/2010 9.0 Updated and revised the technical content. 3/12/2010 9.0.1 Editorial Changed language and formatting in the technical content. 4/23/2010 9.0.2 Editorial Changed language and formatting in the technical content. 6/4/2010 9.1 Minor Clarified the meaning of the technical content. 7/16/2010 9.1 None No changes to the meaning, language, or formatting of the technical content. 8/27/2010 9.1 None No changes to the meaning, language, or formatting of the technical content. 10/8/2010 9.1 None No changes to the meaning, language, or formatting of the technical content. 11/19/2010 9.1 None No changes to the meaning, language,
or formatting of the technical content. 1/7/2011 9.1 None No changes to the meaning, language, or formatting of the technical content. 2/11/2011 9.1 None No changes to the meaning, language, or formatting of the technical content. 3/25/2011 9.1 None No changes to the meaning, language, or formatting of the technical content. 5/6/2011 9.1 None No changes to the meaning, language, or formatting of the technical content. 6/17/2011 9.2 Minor Clarified the meaning of the technical content. 9/23/2011 10.0 Updated and revised the technical content. 12/16/2011 11.0 Major Updated and revised the
technical content. 3/30/2012 11.1 Minor Clarified the meaning of the technical content. 7/12/2012 11.1 None No changes to the meaning, language, or formatting of the technical content. 10/25/2012 12.0 Major Updated and revised the technical content. 1/31/2013 12.0 None No changes to the meaning, language, or formatting of the technical content. 8/8/2013 13.0 Updated and revised the technical content. 11/14/2013 13.0 None No changes to the meaning, language, or formatting of the technical content. 2/13/2014 14.0 Major Updated and revised the technical content. 5/15/2014 14.0 None No changes to the meaning, language, or
formatting of the technical content. 6/30/2015 15.0 Major Significantly changed the technical content. 10/16/2015 15.0 None No changes to the meaning, language, or formatting of the technical content. 7/14/2016 16.0 Major Significantly changed the technical content. 6/1/2017 16.0 None No changes to the meaning, language, or formatting of the technical content.
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: . 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 or set minimum runspaces in a RunspacePool or request for available runspaces in a RunspacePool. Direction: Server to client. Target: RunspacePool. RUNSPACEPOOL_STATE 0x00021005 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.
2 DarkGreen Dark green color. 3 DarkCyan Dark cyan color. 4 DarkRed Dark red color. 5 DarkMagenta Dark magenta color. 6 DarkYellow Dark yellow 7 Gray Gray color. 8 DarkGray Dark gray 9 Blue Blue color. 10 Green color. 11 Cyan Cyan color. 12 Red Red color. 13 Magenta Magenta color. 14 Yellow Yellow color. 15 White White color. The Complex Object described in this section SHOULD have no associated type names (section ). Example: <Obj N="Value" RefId="21"> <MS> <S N="T">System.ConsoleColor</S> <I32 N="V">5</I32> </MS> </Obj> RunspacePoolState This data type represents the state of a .
the current pipeline and start a . ExitNestedPrompt 8 None SHOULD stop the nested pipeline and resume the current pipeline. NotifyBeginApplication 9 None Called by an application to indicate that it is executing a command line application. NotifyEndApplication 10 None Called by an application to indicate that it has finished executing a command line application. Host UI Methods Name of method/property Method identifier Return value Method details ReadLine 11 String (section 2.2.5.1.1) SHOULD read a line of characters from a user. ReadLineAsSecureString 12 Secure String (section ) SHOULD read a line of characters from a user, with the user input not echoed. Write1 13 None. SHOULD write
name, allowed credential and options. PromptForChoice 26 Signed int (section 2.2.5.1.11 SHOULD display a list of choices to the user and MUST return the index of the selected option. Host RawUI Read/Write Properties Name of method/property Method identifier Return value Method details GetForegroundColor 27 (section ) SHOULD return the foreground color of the hosting application. SetForegroundColor 28 None. SHOULD set the foreground color of the hosting application. GetBackgroundColor 29 Color (section 2.2.3.3) SHOULD return the background of the hosting application. SetBackgroundColor 30 None. SHOULD set the background color of the hosting application. GetCursorPosition 31 Coordinates (section ) SHOULD return the current cursor position in the hosting application. SetCursorPosition 32 None. SHOULD set the current
Represents arbitrary precision decimal numbers as defined in . XML Element: <D> XML Content: Follows the XML schema specification for the decimal data type. Example: <D>12.34</D> Array of Bytes Represents an of bytes. XML Element: <BA> XML Content: contents of the byte array represented as a string in base64-encoding Example: <!-- array with 4 bytes: {1, 2, 3, 4} --> <BA>AQIDBA==</BA> GUID Represents a 16-byte (128-bit) number is assumed to be unique in any context as defined in section 3. XML Element: <G> XML Content: UUID string representation defined by [RFC4122]. Example: <G>792e5b37-4505-47ef-b7d2-8711bb7affa8</G> URI Represents a Uniform Resource Identifier (URI) reference as defined in section 4. XML Element: <URI> XML Content: Follows the XML schema specification for the uriReference data type. Contents of the URI MUST be encoded as described in section below. Example: <URI>http://www.microsoft.com/</URI> Null Value Represents a NULL value. XML Element: <Nil> XML Content: Empty element
ShellID The identifier of the RunspacePool the client intends to connect to. <open content> Additional data that assists in connecting to a shell on the server, if any, MUST be Base64 encoded (as specified in ) and packaged in a <connectXml> element with the following format: <connectXml xmlns=http://schemas.microsoft.com/> Base64-Encoded data </connectXml> The <open content> MAY also contain any data that is useful to the shell. The body of the message MAY<9> contain the following optional element: Element Value BufferMode Either of the values "Drop" or "Block" to indicate the buffering mode the server will use when the shell is later disconnected. If the wxf:Connect message is successfully received and processed by the server, the server MUST send either a success or a failure message. The server sends a wxf:ConnectResponse message, described in [MS-WSMV] section 3.1.4.17, to indicate success. The server sends a wxf:Fault message, described in [MS-WSMV] section 2.2.4.43, to indicate failure. The client MUST use a wxf:Connect message to send SESSION_CAPABILITY (section ) and CONNECT_RUNSPACEPOOL (section ) message data to the server. The client MUST NOT send any other message data using a wxf:Connect message. The client also uses the wxf:Connect message to connect to a specific pipeline associated with a RunspacePool. Once the RunspacePool is connected using the wxf:Connect message, the client MUST issue a separate wxf:Connect message to connect to a specific pipeline. The following additional information MUST be added to the body of the second wxf:Connect message: Element CommandId The identifier of the pipeline that the client intends to connect to. Once connected, the client can use the wxf:Send and wxf:Receive messages to send input to and receive output from a pipeline. Rules for the wxf:ConnectResponse Message
none is currently pending for this RunspacePool. 4 The client processes the RUNSPACE_AVAILABILITY message (section ) and removes the corresponding entry from the RunspacePool's CI table (section 3.1.1.2.5). < The server gets the available number of runspaces (section ). The server sends a wxf:SendResponse message (section ) to the client. The server constructs a RUNSPACE_AVAILABILITY message (section 2.2.2.8) and it to the client using wxf:ReceiveResponse message (section ). 5 The client can send the response to the as needed. Host Method Calls Targeted to a Client’s Pipeline The PowerShell Remoting Protocol allows a server to initiate method on the client's host. The typical sequence for initiating the host method call is described in the following table: Step Client Direction Server 1 The server's is in the Running state. 2 The client processes the Host Method call associated with the PIPELINE_HOST_CALL message (section ) and extracts the method to execute (section ). The client hands over the message to the higher layer for further processing. < If a response is expected from the Host method call, the server constructs an integer identifier to represent the message, to be sent, and stores it in the Host calls CI table (section ). The server constructs a PIPELINE_HOST_CALL message (section 2.2.2.27) and sends it to the client using wxf:ReceiveResponse message (section ). If a response is expected from the Host method call, the server pauses executing the pipeline until a response for the Host method is received. 3 If a response (or return is expected from the Host method (section 2.2.3.17), the client > The server processes the message and removes the corresponding from the
A Abstract data model 100 130 56 15 76 98 B 79 79 C 15 178 157 157 Client 100 104 104 129 message processing 111 122 112 113 129 sequencing rules 122 112 113 129 103 155 99 53 60 62 73 73 80 72 Complex objects - serialization of 95 94 contents of containers 94 94 93 93 93 95 91 90 referencing earlier objects 90 90 92 91 152 78 51 153 151 98 D Data model - abstract 100 130 99 E 98 56 63 Examples 157 157 155 152 153 151 158 159 159 156 154 160 F 16 G 158 159 11 H Higher-layer triggered events 104 134 159 67 Host parameters - encoding in host method calls 98 99 99 98 99 98 99 98 98
62 I 162 162 67 14 Initialization 104 134 11 153 K 77 L 98 Local events 129 150 M Message processing client 111 122 112 113 server general ( 135, 136) 137 20 Messages data types 20 21 27 28 28 29 29 32 32 36 37 38 38 38 38 41 42 44 46 48 49 49 56 76 79 79 53 60 62 73 73 80 72 78 51 56 63 67 62 67 77 75 80 72 76 55 55 56 54 52 58 73 98 20 51 81 17 82 syntax 20 98 51 17 82 17 N 12 O 99 Other local events 129 150 51 14 P 81 81 162 75 162 80 17 PPSRP messages - processing rules ERROR_RECORD 127
15 15 72 Primitive - serialization of 86 83 83 83 86 86 83 85 86 87 82 88 88 88 84 85 85 84 83 84 85 85 84 87 87 87 176 76 55 PSRP messages - processing rules APPLICATION_PRIVATE_DATA 125 146 CONNECT_RUNSPACEPOOL 129 150 CREATE_PIPELINE 125 146 DEBUG_RECORD 127 148 ENCRYPTED_SESSION_KEY 124 144 END_OF_PIPELINE_INPUT 126 148 ERROR_RECORD 148 GET_AVAILABLE_RUNSPACES 125 146 GET_COMMAND_METADATA 125 147 INIT_RUNSPACEPOOL 123 144 PIPELINE_HOST_CALL 128 149 PIPELINE_HOST_RESPONSE 128 149 PIPELINE_INPUT 126 148 PIPELINE_OUTPUT 127 148 PIPELINE_STATE 127 148 PROGRESS_RECORD 128 149 PUBLIC_KEY 123 144 PUBLIC_KEY_REQUEST 124 144 RUNSPACE_AVAILABILITY 124 145 RUNSPACEPOOL_HOST_CALL 126 147 RUNSPACEPOOL_HOST_RESPONSE 126 147 RUNSPACEPOOL_INIT_DATA 129 150 RUNSPACEPOOL_STATE 125 145 SESSION_CAPABILITY 122 143 SET_MAX_RUNSPACES 124 145 SET_MIN_RUNSPACES 124 145 USER_EVENT 125 146 VERBOSE_RECORD 128 149 WARNING_RECORD 128 149 55 R 12 14 12 15 56 54
S Security 162 162 Sequencing rules client 122 112 113 server 136 137 Serialization 90 96 97 82 primitive types 86 83 83 83 86 86 83 85 86 87 82 88 88 88 84 85 85 84 83 84 85 85 84 87 87 87 96 structure of complex objects 97 97 97 97 97 82 Server 130 134 134 150 message processing general rules ( 135, 136) 137 150 sequencing 136 137 150 134 156 52 16 154 Syntax 20 data types 20 21 27 28 28 29 29 32 32 36 37 38 38 38 38 41 42 44 46 48 49 49 56 76 79 79 53 60 62 73 73 80 72 78 51 56 63 67 62 67 77 75 80 72 76 55 55 56 54 52 58 73 encoding host parameters in host method calls 98 99
99 98 99 98 99 98 98 51 17 serialization 90 82 82 T Timer events 129 150 Timers 103 134 58 178 17 160 Triggered events - higher-layer 104 134 V 16 15 W 73 WS-MAN messages - processing rules wxf:Command 114 138 wxf:CommandResponse 115 139 wxf:Connect 119 141 wxf:ConnectResponse 120 141 wxf:Create 113 137 wxf:Delete 118 141 wxf:DeleteResponse 119 141 wxf:Disconnect 121 142 wxf:DisconnectResponse 121 142 wxf:Fault 119 141 wxf:Receive 116 139 wxf:ReceiveResponse 117 139 wxf:Reconnect 121 142 wxf:ReconnectResponse 122 143 wxf:ResourceCreated 114 138 wxf:Send 115 139 wxf:SendResponse 116 139 wxf:Signal 118 140 wxf:SignalResponse 118 141