我看到这个问题问了很多,但是大多数答案都归结为四件事:
enable-PSRemoting -force
Set-Item wsman:\localhost\client\trustedHosts -value *
,以确保您的本地系统信任它所连接的所有内容。问题是-即使以上步骤已完成并验证,该问题仍然存在。我发现的是这样的:
Get-WMIObject -computername <remoteSystemNameHere>
有效。 Invoke-Command -Computername <remoteSystemNameHere>
失败(即使提供了凭据)这仅在我们域中的少数服务器上发生,并且无法确定有效和无效服务器之间的区别。我知道这个论坛上已经问了很多这个问题,尽管基本的回答似乎都解决了80-90%的问题,但仍有10-20%的人仍在寻找答案。我确定会提供任何帮助,谢谢。
使用Invoke-Command -computername RemoteServerName.domain.ds -credential $cred -scriptblock {get-process "svchost"}
这是我得到的错误:
[RemoteServerName.domain.ds] Connecting to remote server RemoteServerName.domain.ds failed with the following error message :
The client cannot connect to the destination specified in the request. Verify that the service 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: (RemoteServerName.domain.ds:String) [], PSRemotingTransportException
+ FullyQualifiedErrorId : CannotConnect,PSSessionStateBroken