I have an environment with 16 vms on a host. They all run Windows2008R2. At one point I had powershell remoting work on all servers but one. Then I lost contact with two more. This is annoying, to say the least. Every time I come back to the fact that WinRM is running as a service, but it still doesn't work.
It is setup to use ssl. Invoke-Command -ComputerName "BadMachine" -ScriptBlock {Get-Service | Where-Object {($_.Name -eq "WinRM") -and ($_.Status -eq "Running")}} -ErrorAction Stop -UseSSL -Credential(Get-Credential)
results in the well known
[BadMachine] Connecting to remote server BadMachine failed with the
following error message : WinRM cannot complete the operation. Verify...
etc.,etc.,etc.
On the bad machine, 'winrm quickconfig` says that the WinRM service is already running and then shows the above error.
On the bad machine, Get-Service "WinRM"
returns a nice object saying the service is running.
On the bad machine winrm id
doesn't return anything (on good machines it gives a full IdentifyResponse).
winrm get wmicimv2/Win32_Service?Name=WinRM
gives the above error (on a good machine it returns the status).
cd wsman:
allows me to switch to the wsman provider, and there is localhost. But after navigating to localhost, there is nothing in there. So, cd WSMan:\localhost\Listener
results in a Cannot find path
.
netsh http show urlacl
does not result in anything (on a good machine it returns URL reservations.)
Most articles describe how to setup the powershell remoting and may discuss how to troubleshoot some parts. But, apparently there is so much that can go wrong about winrm and powershell remoting, that my questions are:
How to repair this WinRM installation? Does the fact that they are VMs on a Hyper-V host complicate things? What is still left to test to get to the heart of the problem?