The WS-Management service cannot process the request. Cannot find the Microsoft.PowerShell session configuration in the WSMan: drive on the…

After updating to Ps 4.0, I found some windows hosts are encountering the following errors when I run Invoke-Command to check the powershell version. See Fig-1.

Connecting to remote server X.X.X.X failed with the following error message : The WS-Management service cannot process the request. Cannot find the Microsoft.PowerShell session configuration in the WSMan: drive on the X.X.X.X computer.

Powershell WS-Management service Error
Figure-1: Failed to connect to remote host

After a few googling, I found that the problem is Default Powershell Configuration Session, Microsoft.powershell has been unregistered and there is only Microsoft.powershell.workflow registered. Check it by the following Ps command in elevated administrative mode. See Fig-2.
Get-PSSessionConfiguration

The solution is we need to re-register the default endpoint back. You can enter ‘A’ for all confirmations. This will only register the selected endpoint & restart the WinRM service. See Fig-2j.
Register-PSSessionConfiguration -Name Microsoft.powershell

Then you can check it if it successfully registered. See Fig-2.
Get-PSSessionConfiguration

Re-register the ws-man powershell endpoint
Fig-2: Check & re-register the ws-man endpoint
 
 

Now, re-check you are able to connect the host. See Fig-3.

Powershell Remoting
Fig-3: Recheck the connection

(We need Powershell remote endpoints when connecting to remote computers by New-PSSession or Invoke-Command to make a successful remote powershell session. The standard (default) one is Microsoft.powershell. We can also restrict users permissions, specific cmdlets/functions that are allowed to users to run and  by creating new custom endpoints or modifying current endpoints, that is called Constrained Endpoints. You can check the default endpoint configuration by this command.
 Get-PSSessionConfiguration -Name microsoft.powershell | Select *
You can learn more about Powershell Endpoints & how to setup constrained endpoints here>>
https://blogs.technet.microsoft.com/heyscriptingguy/2014/03/31/introduction-to-powershell-endpoints/
http://blog.netwrix.com/2015/02/11/secure-powershell-remoting-using-constrained-endpoints/
)

3 thoughts on “The WS-Management service cannot process the request. Cannot find the Microsoft.PowerShell session configuration in the WSMan: drive on the…”

Leave a Reply

Your email address will not be published. Required fields are marked *