"The WS-Management service cannot process the request" error message after the WinRM service restarts in Windows Server 2012

Applies to: Windows Server 2012 DatacenterWindows Server 2012 EssentialsWindows Server 2012 Foundation More


Consider the following scenario:
  • You have a computer that is running Windows Server 2012.
  • You run Windows Remote Management (WinRM) commands against a destination computer that is running Windows Server 2012 in a WinRM session.
  • The WinRM service on the destination computer restarts after the commands finish.
  • You run some more commands against the destination computer in the same WinRM session.
In this scenario, you receive the following error message:
The WS-Management service cannot process the request. The request contains one or more invalid SOAP headers.
Note This issue occurs on rare occasions within 5 minutes of the WinRM service restarting. 


This issue occurs because of the interaction between a mechanism in WinRM that provides robustness to short-term network issues and the Microsoft Windows HTTP Services (WinHTTP) layers.  
If rerunning the commands has no unwanted side effect, rerun the commands. Otherwise, check whether the commands were run on the destination computer. If they were not run, rerun the commands.