系统:Windows Server 2012 R2 | PowerShell v4 | 詹金斯 v1.607 | 64 位 Java 版本 8u60
无论出于何种原因,我都能够登录到运行 Jenkins 的 Windows 服务器,并毫无问题地执行以下代码:
Start-Job -Credential $Creds -ScriptBlock {Get-Process}
Get-Job | Wait-Job | Receive-Job
在尝试在 Jenkins 作业中执行相同的代码时,使用 PowerShell 插件,使用我在 $Creds 中使用的相同用户凭据,它会在没有任何有用信息的情况下失败。凭证已通过验证。这是我得到的错误:
[localhost] The background process reported an error with the following message: .
+ CategoryInfo : OpenError: (localhost:String) [], PSRemotingTransportException
+ FullyQualifiedErrorId : 2100,PSSessionStateBroken
我使用Resolve-Error 函数(如此处所示)来尝试获取更多信息。这是输出:
writeErrorStream : True
PSMessageDetails :
Exception : System.Management.Automation.Remoting.PSRemotingTransportException: The background process
reported an error with the following message: .
TargetObject : localhost
CategoryInfo : OpenError: (localhost:String) [], PSRemotingTransportException
FullyQualifiedErrorId : 2100,PSSessionStateBroken
ErrorDetails : [localhost] The background process reported an error with the following message: .
InvocationInfo :
ScriptStackTrace :
PipelineIterationInfo : {}
00000000000000000000000000000000000000000000000000000000000000000000000000000000
ErrorCode : 2100
TransportMessage :
ErrorRecord : The background process reported an error with the following message: .
StackTrace :
WasThrownFromThrowStatement : False
Message : The background process reported an error with the following message: .
Data : {}
InnerException :
TargetSite :
HelpLink :
Source :
HResult : -2146233087
仍然没有有用的信息。我不知道可能是什么问题,也不知道如何进行。