PowerShell:使用 Invoke-Command 执行命令时出错? [英] PowerShell: error executing command using Invoke-Command?

查看:73
本文介绍了PowerShell:使用 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?

推荐答案

有2个基本原因:

1) 远程计算机没有安装 Powershell

1) remote computer has not Powershell installed

2) 远程 PC 上未启用 PSremoting(要启用它,请阅读我在您回答中的评论)

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

这篇关于PowerShell:使用 Invoke-Command 执行命令时出错?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆