4.1.2 Connecting to a RunspacePool

The typical PowerShell Remoting Protocol sequence for successfully connecting to an existing RunspacePool on the server is shown in the following table.






The client initializes the RunspacePool state to Connecting (see section The client connects with the server using a wxf:Connect message (see section that includes the SESSION_CAPABILITY and CONNECT_RUNSPACEPOOL messages.


The server processes the message and validates the ProtocolVersion (see section server processes the CONNECT_RUNSPACEPOOL message. The server sets the RunspacePool state (section to Connecting.



The server sends a success message (see section along with the server's negotiation information and the RUNSPACEPOOL_INIT_DATA message, if validation succeeds.


The client processes the server's Session Capability object and, if successful (as described in section, takes the following actions:

  • The client changes the RunspacePool state (see section to NegotiationSucceeded.

  • The client processes the RUNSPACEPOOL_INIT_DATA message and changes the RunspacePool to Opened.

  • The client issues a wxf:Receive request to the server.




The server uses a wxf:ReceiveResponse message (see section to send an APPLICATION_PRIVATE_DATA message (see section The server changes the RunspacePool state to Opened.


The client receives the APPLICATION_PRIVATE_DATA message and passes it to the higher layer.