Holy smokes this was such a pain in the a$$ to troubleshoot. I was just trying to enter a remote PowerShell session to my server that runs all my Dockers so I could work some magic with them.

Simple command from an elevated PowerShell window:

Enter-PSSession -ComputerName SERVER -Credential "[email protected]"

There were several errors that surfaced, of which I was able to finally get rid of them all.

  • Set-PSSessionConfiguration : Access is denied. To run this cmdlet, start Windows PowerShell with the “Run as administrator” option.
  • WinRM firewall exception will not work since one of the network connection types on this machine is set to Public. Change the network connection type to either Domain or Private and try again.
  • Enter-PSSession : Connecting to remote server failed with the following error message : Access is denied.
  • Enter-PSSession : Connecting to remote server failed with the following error message : The WinRM client cannot process the request. If the authentication scheme is differ ent from Kerberos, or if the client computer is not joined to a domain, then HTTPS transport must be used or the destination machine must be added to the TrustedHosts configuration setting. Use winrm.cmd to configure TrustedHosts. Note that computers in the TrustedHosts list might not be authenticated. You can get more information about that by running the following command: winrm help config. For more information, see the about_Remote_Troubleshooting Help topic.

To clarify, I was trying to connect from my laptop aka CLIENT machine to my server aka TARGET machine, also, all commands listed below were run from an elevated PowerShell terminal.

I ran these on the CLIENT machine; I included the machine names and respective IP addresses for each:

Set-Item -Path WSMan:\localhost\Client\TrustedHosts -Value "xxx.xxx.xxx.xxx,TARGET"
# to view the entry
Get-Item WSMan:\localhost\Client\TrustedHosts

I ran these on the TARGET machine:

Set-Item -Path WSMan:\localhost\Client\TrustedHosts -Value "xxx.xxx.xxx.xxx,CLIENT"
# to view the entry
Get-Item WSMan:\localhost\Client\TrustedHosts

And because things are never as easy as they should be unless you’re dealing with Docker containers, this was the last error:

Enter-PSSession : Connecting to remote server failed with the following error message : Access is denied.

This fixed it all up for me…I ran it on both machines for shits & giggles. I selected the account I wanted to use and gave full rights.

Set-PSSessionConfiguration -ShowSecurityDescriptorUI -Name Microsoft.PowerShell