PowerShell Remoting outside Domain by IP

rated by 0 users
This post has 2 Replies | 2 Followers

Top 500 Contributor
Posts 12
o_o Posted: 04-01-2013 12:44 PM

 

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 -Credential <username>

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 Help topic.

At line:1 char:16

+ Enter-PSSession <<<<  -ConnectionUri http://<remote_ip>:5895 -Credential <username>

    + CategoryInfo          : InvalidArgument: (http://<remote_ip>:5895/:Uri) [Enter-PSSession], PSRemotingTranspor

   tException

    + 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:

Enter-PSSession -ConnectionUri http://<remote_ip>:5985 -Credential <username>

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:

<domain>\<username>

Finally TrustedHosts is a * on both machines.

I would appreciate any help or ideas. Thank you to all.

 

Top 25 Contributor
Posts 502
Microsoft MVP
Top Contributor

Sure, it's possible.

Here I connect to my Azure VM from a laptop using both syntaxes (-ComputerName / -ConnectionUri):

PS> Enter-PSSession -ComputerName 168.61.36.99 -Credential $cred

[168.61.36.99]: PS C:\Users\Administrator\Documents> hostname

DC

[168.61.36.99]: PS C:\Users\Administrator\Documents> exit-pssession

PS> Enter-PSSession -ConnectionUri http://168.61.36.99:5985 -Credential $cred

[168.61.36.99]: PS C:\Users\Administrator\Documents> hostname

DC

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? 

 

 

Top 500 Contributor
Posts 12

 

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. Surprise I know this is embarrassing Hmm 

 

Thanks again,

O. O.

 

Page 1 of 1 (3 items) | RSS
Copyright 2012 PowerShell.com. All rights reserved.