PowerShell: error executing command using Invoke-Command?

丶灬走出姿态 提交于 2019-12-23 08:08:34

问题


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?


回答1:


There is 2 basical reason:

1) remote computer has not Powershell installed

2) PSremoting is not enabled on remote PC (to enable it read my comment in you answer)



来源:https://stackoverflow.com/questions/7331844/powershell-error-executing-command-using-invoke-command

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!