I cannot connect to remote server using enter-pssession -computername serverA
. My scenario:
winrm quickconfig
)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
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.