当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] WinRM 无法完成操作

作者:精品下载站 日期:2024-12-14 13:40:27 浏览:14 分类:玩电脑

WinRM 无法完成操作


[玩转系统] WinRM 无法完成操作

在某些情况下,当尝试使用以下命令建立远程 PowerShell 连接时,您会收到错误消息“WinRM 无法完成操作”:

Enter-PSSession [server name]

错误消息可能如下所示:

Connecting to remote server myserver.domain.com 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 -ConnectionURI "$connectionUri" -ConfigurationName Micr ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace)
[Enter-PSSession], PSRemotingTransportException
FullyQualifiedErrorId : WinRMOperationTimeout,PSSessionOpenFailed

此错误背后有两个典型的根本原因。

  • WinRM 流量被目标服务器或目标服务器前面的防火墙阻止。
  • WinRM 未在目标系统上正确配置。

WinRM 流量被防火墙阻止 - 如何测试

您可以使用 PowerShell 检查 WinRM 端口 (TCP 5985) 的网络连接问题。

连接问题将导致类似的输出:

PS C:\> Test-NetConnection 192.168.68.240 -Port 5985
WARNING: TCP connect to (192.168.68.240 : 5985) failed


ComputerName           : 192.168.68.240
RemoteAddress          : 192.168.68.240
RemotePort             : 5985
InterfaceAlias         : Ethernet
SourceAddress          : 192.168.68.245
PingSucceeded          : True
PingReplyDetails (RTT) : 0 ms
TcpTestSucceeded       : False

如果连接工作正常,输出将如下所示:

PS C:\> Test-NetConnection 192.168.68.240 -Port 5985


ComputerName     : 192.168.68.240
RemoteAddress    : 192.168.68.240
RemotePort       : 5985
InterfaceAlias   : Ethernet
SourceAddress    : 192.168.68.245
TcpTestSucceeded : True

WinRM 未配置 - 如何配置

第二个典型的根本原因是 WinRM 服务未运行或未针对远程会话正确配置。

您可以通过运行以下命令来修复此问题:

WinRM QuickConfig

如果 WinRM 服务确实有故障,您将看到类似以下的输出:

PS C:\ WinRM QuickConfig
WinRM service is already running on this machine.
 WinRM is not set up to allow remote access to this machine for management.
 The following changes must be made:

 Create a WinRM listener on HTTP://* to accept WS-Man requests to any IP on this
 machine.

 Make these changes [y/n]? y

 WinRM has been updated for remote management.

 Created a WinRM listener on HTTP://* to accept WS-Man requests to any IP on this
 machine.

如果 WinRM 服务已正确配置,您将看到类似于以下内容的输出:

PS C:\> WinRM QuickConfig
WinRM service is already running on this machine.
WinRM is already set up for remote management on this computer.

如何摆脱混合 Office 365 管理地狱

如果您厌倦了在众多管理控制台和 PowerShell 之间不断切换来执行简单的一级用户支持,那么您并不孤单。

公司开始意识到标准混合 Office 365 管理工具看起来很像这样:

[玩转系统] WinRM 无法完成操作

在过去十年中,我们执行了大量向混合 Office 365 的迁移。

我们从客户那里收到的一致反馈促使我们开发了 Easy365Manager。

更简单、更快、响应更灵敏的界面来管理您的本地用户、Office 365 许可证和 Exchange Online 邮箱:

[玩转系统] WinRM 无法完成操作

[玩转系统] WinRM 无法完成操作

Easy365Manager 将所有日常 Exchange Online 邮箱管理和许可证管理集成到流行的 AD 用户和计算机工具中。

AD 用户和计算机是一个众所周知的直观界面,因此这可以减轻您的帮助台学习另一个工具的负担。

有了Easy365Manager,您的一级支持者可以立即开始工作!

请查看我们的操作方法部分,将使用 Easy365Manager 的标准操作与您当前的程序进行比较。

您会发现 Easy365Manager 甚至可以让您管理日历权限,这只能通过使用 Microsoft 标准工具的复杂 PowerShell 脚本来实现:

Easy365Manager 是 AD 用户和计算机的简单管理单元。

您无需进行任何基础架构更改即可运行它,并且可以从任何运行 AD 用户和计算机的 PC 或服务器运行 Easy365Manager。

安装和配置 Easy365Manager 只需几分钟。

阅读更多信息并在此处下载我们的 30 天全功能试用版。

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯