【发布时间】:2020-10-20 09:28:51
【问题描述】:
当我尝试在远程计算机上连接到 Powershell 时会发生这种情况:
PS C:\Users\Jonathan> Test-WSMan -ComputerName 54.228.XX.XX
Test-WSMan : The WinRM client cannot complete the operation within the time specified. Check if the machine name is val
id and is reachable over the network and firewall exception for Windows Remote Management service is enabled.
At line:1 char:11
+ Test-WSMan <<<< -ComputerName 54.228.XX.XX
+ CategoryInfo : InvalidOperation: (54.228.XX.XX:String) [Test-WSMan], InvalidOperationException
+ FullyQualifiedErrorId : WsManError,Microsoft.WSMan.Management.TestWSManCommand
在我的远程计算机上,我已确认 WinRM 正在运行:
PS C:\Users\Administrator> net start winrm
The Windows Remote Management (WS-Management) service is starting.
The Windows Remote Management (WS-Management) service was started successfully.
我已经确认它正在监听:
PS C:\Users\Administrator> winrm e winrm/config/listener
Listener
Address = *
Transport = HTTP
Port = 5985
Hostname
Enabled = true
URLPrefix = wsman
CertificateThumbprint
ListeningOn = 10.35.XXX.XXX, 127.0.0.1...
我选择信任所有主机:
PS C:\Users\Administrator> Set-Item WSMan:\localhost\Client\TrustedHosts -Value "*" -Force
最后,我允许端口 5985 上的入站连接。我错过了什么吗?!
【问题讨论】:
-
在两台机器上尝试
Enable-PSRemoting。 -
-ComputerName 54.228.XX.XX与ListeningOn = 10.35.XXX.XXX? -
这个问题你解决了吗?我们一直在为基本相同的问题而烦恼。防火墙关闭。一切都按照关于设置 winrm 的数百个帖子进行设置。我们可以从同一台服务器远程登录到本地主机上的服务,但不能通过 IP 地址。 Windows 2012。无法想象是什么阻止了通过 IP 地址的连接,但在 localhost 上工作正常。
-
@ActionDan 很遗憾没有,我想我最终放弃了。
-
@Jonathan 感谢更新,我们也在做同样的事情。
标签: powershell winrm wsman