Is it possible to remote into a external server outside my
domain? (By remote I mean start a PSSession). I am attempting the following:
Enter-PSSession -ConnectionUri http://<remote_ip>:5985
I then get a popup window asking me to enter the password. After
I do, I get the following:
Enter-PSSession : Connecting to remote server failed with
the following error message : The client cannot connect to the destination
specified in the request. Verify that the service on the destination is running
and is accepting requests. Consult the logs and documentation for the
WS-Management service running on the destination, most commonly IIS or WinRM.
If the destination is the WinRM service, run the following command on the
destination to analyze and configure the WinRM service: "winrm
quickconfig". For more information, see the about_Remote_Troubleshooting
At line:1 char:16
+ Enter-PSSession <<<< -ConnectionUri http://<remote_ip>:5895
CategoryInfo : InvalidArgument:
(http://<remote_ip>:5895/:Uri) [Enter-PSSession], PSRemotingTranspor
FullyQualifiedErrorId : CreateRemoteRunspaceFailed
I have tried the following:
I first attempted on my local machine to check if the remote machine was
actually listening the port:
telnet <remote_ip> 5985
And the Port seems to be open. I also have temporarily disabled
the firewalls on both machines in the above attempts.
At the remote machine I attempted:
This worked and I verified that the password I was using was correct.
(This is my attempt to start a PSSession from the Remote machine to itself. Since
this worked I am convinced that my credentials are correct and PowerShell
Remoting has been enabled on the Remote Machine.)
By the way, I have also tried to use the username normally
and also along with the remote domain name in the form:
Finally TrustedHosts is a * on both machines.
I would appreciate any help or ideas. Thank you to all.
Sure, it's possible.
Here I connect to my Azure VM from a laptop using both syntaxes (-ComputerName / -ConnectionUri):
PS> Enter-PSSession -ComputerName 126.96.36.199 -Credential $cred
[188.8.131.52]: PS C:\Users\Administrator\Documents> hostname
[184.108.40.206]: PS C:\Users\Administrator\Documents> exit-pssession
PS> Enter-PSSession -ConnectionUri http://220.127.116.11:5985 -Credential $cred
Remoting is enabled on a remote machine, and its IP address is added to the TrustedHosts list on the client. (There is no need to modify TrustedHosts list on a remote server.)
Try to enable remoting again on a remote server. Can you connect in the opposite direction, from the remote server to your client?
Thank you Aleksandar. I have no clue why, but I don’t get the
errors I described in my original post now. I did not restart my computers or
anything – just went home and came back to work. I know this is embarrassing