简体   繁体   English

PowerShell:使用Invoke-Command执行命令错误?

[英]PowerShell: error executing command using Invoke-Command?

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? 这是什么原因以及如何解决?

There is 2 basical reason: 有两个基本原因:

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(为了使其能够在您的回答中阅读我的评论)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM