WSMan-InvalidShellID error when you create remote PowerShell sessions in an Exchange Server 2013 environment

Applies to: Exchange Server 2013 EnterpriseExchange Server 2013 Standard Edition


Consider the following scenario:
  • You deploy different cumulative updates for Microsoft Exchange servers in an Exchange Server 2013 environment.
  • You configure a load balancer that doesn't use session affinity for HTTP and a namespace for PowerShell.
  • You use the following Exchange Management Shell to create remote PowerShell sessions across the load balancer:

    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -AllowRedirection
    Import-PSSession $Session
In this scenario, the connection isn't successful. Additionally, you receive a WSMan-InvalidShellID error that resembles the following: 
New-PSSession : [] Processing data from remote server failed with the following error message: [ClientAccessServer=Server1,, RequestId=IDNumber, TimeStamp=Date/Time] [FailureCategory=WSMan-InvalidShellID] The request for the Windows Remote Shell with ShellId ShellIDNumner failed because the shell was not found on the server.Possible causes are: the specified ShellId is incorrect or the shell no longer exists on the server. Provide the correct ShellId or create a new shell and retry the operation. For more information, see the bout_Remote_Troubleshooting Help topic.


This issue occurs because the remote PowerShell sessions aren't routed constantly to the same Mailbox server.


To work around this issue, use one of the following methods:
  • Configure the load balancer to use session affinity or persistence.
  • Have the Exchange servers use the same cumulative update build in load balancing.



Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.