WinRM无法完成操作.验证指定的计算机名称是否有效

Ram*_*san 4 powershell

当我尝试在远程计算机上获取服务信息时,我收到了WINRM错误.

 PS C:\Windows\system32> invoke-command -computername Node1 -ScriptBlock {gsv}
 [Node1] Connecting to remote server Node1 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.
+ CategoryInfo          : OpenError: (Node1:String) [], PSRemotingTransportException
+ FullyQualifiedErrorId : WinRMOperationTimeout,PSSessionStateBroken
Run Code Online (Sandbox Code Playgroud)

Ram*_*san 10

尝试以下解决方法来修复WINRM问题.

连接到远程服务器并以管理员身份从cmd运行以下命令.

    C:\Windows\system32>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.
Run Code Online (Sandbox Code Playgroud)


Eri*_*sen 6

您是否检查了远程计算机的防火墙规则?默认规则只允许本地子网中的 IP。

要允许其他 IP:

  1. 打开具有高级安全性的 Windows 防火墙
  2. 单击入站规则
  3. 双击Windows远程管理(HTTP)个公共简介
  4. 单击范围选项卡
  5. Remote IP address 下,添加您需要的任何 IP

远程 IP 地址必须位于本地子网中的 WinRM 防火墙规则的屏幕截图

  • 在服务器核心上,您可以运行`netsh advfirewall防火墙添加规则名称=“Windows远程管理(HTTP-In)”dir = in操作=允许服务=任何启用=是配置文件=任何本地端口= 5985协议= tcp` (2认同)

小智 5

两台计算机上都启用了WinRM吗???

winrm quickconfig
Run Code Online (Sandbox Code Playgroud)

并检查一下。