0

我正在使用一些部署PowerShell脚本,我计划使用Bamboo进行部署。在这些PowerShell脚本中,我想在本地网络上的远程计算机上运行命令。我想使用Invoke-Command并使用远程计算机的本地管理员帐户作为凭证,如下所示;我如何使用本地计算机帐户作为PSExec的凭证

Invoke-Command -ComputerName DevBox -Credential DevBox\Administrator -ScriptBlock { ... } 

但是,当我运行脚本时,出现此错误消息;

[DevBox] Connecting to remote server DevBox failed with the following error 
message : WinRM cannot process 
the request. The following error with errorcode 0x80090311 occurred while 
using Kerberos authentication: We can't sign 
you in with this credential because your domain isn't available. Make sure 
your device is connected to your 
organization's network and try again. If you previously signed in on this 
device with another credential, you can sign 
in with that credential. 

不会调用命令无法与远程计算机的本地管理员帐户的工作。

我可以使用PSExec并且它可以正常工作,但如果可能的话,我宁愿使用Invoke-Command。

我已验证WinRM已安装并在远程计算机上运行,​​使用来自远程计算机桌面的Enable-PSRemoting -Force。

任何想法?

+0

你能在这里发布确切的错误信息 –

+0

我编辑了我原来的帖子以包含错误信息。 – EiEiGuy

+0

您的远程计算机是否位于同一个域中? 您是否使用在各自的远程计算机中拥有本地管理员权限的帐户? –

回答

0

如果这行代码位于脚本中,请尝试单独执行该命令并且 您应该从提升的PowerShell会话执行该命令。

+0

我正在使用提升的PowerShell会话。 – EiEiGuy

相关问题