简体   繁体   中英

Two VM's on same subnet in Azure. Can PSRemote to one machine but not the other?

I have two VM's setup one is a windows server and other is win 10 client.

Here is a list of actions taken after spinning up the VMs:

  1. Run Enable-AzVMPSRemoting on both machines in azure cloud shell
  2. Run Enable-PSRemoting -Force on both machines while logged in
  3. Ran 'winrm quickconfig' on both machines (This did not seem to work on the windows server)
  4. Check both firewalls and make sure that WinRM ports are allowing traffic

Using this command from Server -> Client works:

PS C:\Users\sekkha> test-netconnection 10.0.0.5 winrm


ComputerName     : 10.0.0.5
RemoteAddress    : 10.0.0.5
RemotePort       : 5985
InterfaceAlias   : Ethernet
SourceAddress    : 10.0.0.4
TcpTestSucceeded : True

However, it fails when going the other way. Enter-PSSession works when going from Server-> Client (10.0.0.4 -> 10.0.0.5) but again, fails when going the other way.

What have I missed here? I want to be able to PSRemote into the server from my local machine. However, It doesn't work using the public IP address:

PS C:\WINDOWS\system32> enter-pssession 52.xxx.xx.xxx -credential (Get-Credential)

cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
Credential
enter-pssession : Connecting to remote server 52.xxx.xx.xxx failed with the following error message : WinRM cannot complete the operation. Verify that the specified computer name is
valid, that the computer is accessible over the network, and that a firewall exception for the WinRM service is enabled and allows access from this computer. By default, the WinRM
firewall exception for public profiles limits access to remote computers within the same local subnet. For more information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:1
+ enter-pssession 52.xxx.xx.xx -credential (Get-Credential)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (52.xxx.xx.xxx:String) [Enter-PSSession], PSRemotingTransportException
    + FullyQualifiedErrorId : CreateRemoteRunspaceFailed

When I ran this command, the public ip address (52.xxx.xx.xxx) was added to my local machines trusted hosts, but still didn't work.

It seems to be working now. I ran winrm quickconfig on the server and it now allows me to PSRemote from the second machine. I'm not sure why this command didn't work before. I guess it froze and I stopped it.

Now if I can just figure out how to remote in from my own machine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM