WinRM 监听器并非全神贯注

WinRM 监听器并非全神贯注

当我尝试连接到远程计算机上的 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 上的入站连接。我遗漏了什么吗?!

答案1

我知道这是一个老话题,但我遇到了同样的问题,并且花了将近一整天的时间才解决这个问题。

根据这篇 Reddit 文章,您必须更新与“Windows 远程管理”相对应的防火墙规则以允许连接(即使它不安全)!据我所知,这是使 WinRM 在服务器管理器中工作的唯一方法,因为它使用 HTTP,即使在生产环境中也是如此!

答案2

您是否检查过 Windows 防火墙以确保已启用 Windows 远程管理 (In) 规则?我猜该规则未启用。

您的 WinRM 配置看起来很好,所以它很可能是一个基于主机的防火墙或某个地方的网络防火墙。

答案3

如果您在 AWS 实例上托管服务器,则需要确保与您的实例关联的安全组配置为允许入站 TCP 5985 和 5986 流量。

相关内容