windows PowerShell:使用 Invoke-Command 执行命令时出错?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7331844/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PowerShell: error executing command using Invoke-Command?
提问by jrara
I'm trying to execute the following statement on remoter server:
我正在尝试在远程服务器上执行以下语句:
Invoke-Command -ComputerName server1 -ScriptBlock {Get-Process}
but I get an error message:
但我收到一条错误消息:
[server1] Connecting to remote server failed with the following error message : The client cannot connect to the destination specified in the request. Verify that the serv
ice on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS
or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig". For more
information, see the about_Remote_Troubleshooting Help topic.
+ CategoryInfo : OpenError: (:) [], PSRemotingTransportException
+ FullyQualifiedErrorId : PSSessionStateBroken
What is the reason for this and how to fix it?
这是什么原因以及如何解决?
回答by CB.
There is 2 basical reason:
有2个基本原因:
1) remote computer has not Powershell installed
1)远程电脑没有安装Powershell
2) PSremoting is not enabled on remote PC (to enable it read my comment in you answer)
2) 远程 PC 上未启用 PSremoting(要启用它,请阅读我在您回答中的评论)