无法在服务器上调用命令(Powershell)

Impossible to invoke command on a server (Powershell)

我遇到了一个问题,我无法远程执行 powershell 命令。

Invoke-Command -ComputerName MYCOMPUTER -Credential MYDOMAIN\MYUSER -ScriptBlock {Get-Culture}

这是我的错误日志:

Winrs error:WinRM cannot process the request. The following error occured while using Kerberos authentication: The network path was not found.

Possible causes are:

-The user name or password specified are invalid. -Kerberos is used when no authentication method and no user name are specified.

-Kerberos accepts domain user names, but not local user names. -The Service Principal Name (SPN) for the remote computer name and port does not exist.

-The client and remote computers are in different domains and there is no trust between the two domains. After checking for the above issues, try the following:

-Check the Event Viewer for events related to authentication. -Change the authentication method; add the destination computer to the WinRM TrustedHosts configuration setting or use HTTPS transport.

我在服务器上拥有完全权限,我在管理员中也做了 "Enable-PSRemoting -Force",WinRm quickconfig",我可以 ping 服务器并连接它。

这很奇怪,因为我可以在另一台具有相同版本 Windows (Windows Server 2008 R2) 和相同版本 powershell (2.0) 的服务器上执行此操作。 你能帮帮我吗?

谢谢

您可以验证 受信任主机的可用性 :

  1. 通过右键单击 Windows PowerShell 快捷方式并选择 运行 作为管理员,以管理员身份启动 Windows PowerShell。

  2. 在 PowerShell 提示符下,您可以使用以下命令验证 WinRM 服务是否 运行:

    获取服务 winrm

输出中 Status 属性 的值应为“运行ning”。

  1. 要配置 Windows PowerShell 进行远程处理,请键入以下命令:

    启用-PSRemoting –force

使用以下命令在受信任的主机下添加远程系统:

winrm s winrm/config/client '@{TrustedHosts="RemoteComputer"}'

然后您可以使用以下命令检查相同内容:

winrm quickconfig

参考 Link : Enabling Remoting in Powershell