Powershell-在服务器上远程执行脚本
问题描述:
我想从server01下运行PowerShell脚本。我在server03上有帐户,所以没有通过凭证。即使我通过它,也会出现相同的错误消息。Powershell-在服务器上远程执行脚本
我的帐户位于domainA和server01上,服务器03位于domainB上。如果我使用另一个属于DomainB的帐户登录到server01,则该脚本可以正常工作。
在我跨域PS执行之前还有什么需要启用的吗?
Invoke-Command -ComputerName server03 -FilePath E:test\test.ps1
[Server03] Connecting to remote server failed with the following error message : 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 us
e HTTPS transport.
Note that computers in the TrustedHosts list might not be authenticated.
-For more information about WinRM configuration, run the following command: winrm help config. For more information,
see the about_Remote_Troubleshooting Help topic.
+ CategoryInfo : OpenError: (:) [], PSRemotingTransportException
+ FullyQualifiedErrorId : PSSessionStateBroken
答
我已经为服务器添加了FDQN,它工作正常。
调用命令-ComputerName server03.domain.com -FilePath E:测试\ test.ps1
这是双跳问题。考虑使用CredSSP,但要彻底研究它,因为可能存在启用它的安全隐患。 –