我尝试通过其公共IP地址获取部署在Azure上的Windows Server 2016的远程PowerShell会话(最初我试图configuration服务器pipe理工具网关,但是即使在两个完全相同的新部署的服务器之间,我也无法使其工作)。
我有两台服务器(目标10.0.0.4和源10.0.0.5 )连接到同一个子网,我可以从源连接到本地networking上的目标( 10.0.0.0 ):
PS C:\> Set-Item WSMan:\localhost\Client\TrustedHosts -Value "10.0.0.4" -Concatenate -Force PS C:\> Enter-PSSession -ComputerName 10.0.0.4 -Credential (Get-Credential) cmdlet Get-Credential at command pipeline position 1 Supply values for the following parameters: Credential [10.0.0.4]: PS C:\Users\techraf\Documents> exit
但是,如果我尝试使用目标的公共IP地址,连接就会被拒绝:
PS C:\> Set-Item WSMan:\localhost\Client\TrustedHosts -Value "13.85.78.151" -Concatenate -Force PS C:\> Enter-PSSession -ComputerName 13.85.78.151 -Credential (Get-Credential) cmdlet Get-Credential at command pipeline position 1 Supply values for the following parameters: Credential Enter-PSSession : Connecting to remote server 13.85.78.151 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 -ComputerName 13.85.78.151 -Credential (Get-Credentia ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (13.85.78.151:String) [Enter-PSSession], PSRemotingTransportException + FullyQualifiedErrorId : CreateRemoteRunspaceFailed
在尝试之前我有:
我也从源机器用nmap检查了目标端口,5985打开时,5986closures(包括10.0.0.0networking上的连接)。
还有什么需要使其工作?
您在部署虚拟机时使用哪种模式? 如果是ASM(Azure服务pipe理),那么请尝试将这两个虚拟机部署在不同的云服务中。
我已经在ARM(Azure资源pipe理器)中testing过了,WinRM在我只打开TCP端口5985的时候工作。
•在目标系统上禁用(完全testing)Windows防火墙
你是如何禁用防火墙的? 请不要停止服务,这可能会导致意外的防火墙行为。 我们需要用GUIclosures防火墙。
我也从源机器用nmap检查了目标端口,5985打开时,5986closures(包括10.0.0.0networking上的连接)。
您需要在目标服务器上执行networking捕获以查找此通信的详细过程。