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

时间:2016-10-07 12:13:26

标签: 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

3 个答案:

答案 0 :(得分:7)

尝试以下解决方法来解决WINRM问题。

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

                jQuery(function($){
                    var price = <?php echo $product->get_price(); ?>,
                        currency = '<?php echo get_woocommerce_currency_symbol(); ?>';
                    $('[name=quantity]').change(function(){
                        if (this.value >= 10) {
                            var newPrice = price * 1.2; 
                            var product_total = parseFloat(newPrice * this.value);
                            $('#product_total_price .price').html( currency + product_total.toFixed(2));
                        } else if (this.value >= 1) {
                            var product_total = parseFloat(price * this.value);
                            $('#product_total_price .price').html( currency + product_total.toFixed(2));
                        } else {
                            // do nothing
                        }
                    });
                });

答案 1 :(得分:5)

是否在两台计算机上启用了WinRM ???

运行

winrm quickconfig

并检查它。

答案 2 :(得分:4)

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

要允许其他IP:

  1. 使用高级安全性打开Windows防火墙
  2. 点击入站规则
  3. 双击公共配置文件的 Windows远程管理(HTTP-In)
  4. 点击范围标签
  5. 远程IP地址下,添加您需要的所有IP

A screenshot of a WinRM firewall rule on which the remote IP address must be in the local subnet