Powershell remoting error – network path not found

powershellpowershell-remoting

I cannot connect to remote server using enter-pssession -computername serverA. My scenario:

  • I have 2 Win 2003 R2 servers in the same domain. ServerA is WSUS server, serverB is a domain controller
  • Both servers have enabled powershell remoting
  • Both servers have configured winrm (winrm quickconfig)
  • Both servers have TrustedHosts set to *
  • setspn.exe is set up correctly (http, https, wsman etc.)
  • Both servers have FireWall turned off
  • Both servers have PowerShell 2.0

I am trying to enter-pssession -computername serverA under the domain admin credentials from serverB to serverA and it throws the following error:

"""Enter-PSSession : Connection to remote server failed with the following error message : WinRM cannot process the request. The following error occured while using Kerberos authentication: The network path was not found."""

When I try to enter-pssession -computername serverB under the domain admin credentials from serverA it works fine! It also works if I use localhost so: enter-pssession -computername localhost under the domain admin credentials (on serverA) works as well, but when I try the hostname on serverA (instead of localhost) enter-pssession -computername serverA it throws the same error.

I also tried to use get-credential and provide different types of credentials, but it did not help. The only thing which helped was using a local (not domain) administrator account and running enter-pssession -computername serverA -credentials $cred and it worked, but only locally, I was able to do this from local machine (from serverA to itself) but not from serverB to serverA under the serverA\administrator credentials.

Any ideas?

Thanks

Best Solution

First of all I created credential variable with my domain admin account:

$cred = get-credential - I typed my domain\username and password

Then I used IP address instead of hostname in -ComputerName parameter, so the enter-pssession looks like:

Enter-Pssession -ComputerName 192.168.1.111 -Credential $cred

this approach works for the invoke-command as well

invoke-command -ComputerName 192.168.1.111 -Credential $cred -ScriptBlock {hostname}

I still do not know why it does not work with the hostname and why do I have to create $cred, but as I need a quick solution, this works fine for me.

Thanks for help.