我正在尝试从 Jenkins 运行 PowerShell 脚本,但它似乎完全忽略了执行策略!这可以通过直接执行 powershell.exe 或使用PowerShell 插件来实现
附加信息:
Jenkins 作为 Windows 服务运行(使用本地系统帐户,非交互式)。连接到该服务器并检查执行策略确实是RemoteSigned
:
PS C:\> whoami
nt authority\system
PS C:\> Get-ExecutionPolicy
RemoteSigned
PS C:\>
但是,在运行 Jenkins 构建时,情况并非如此。Get-ExecutionPolicy -List
这是在构建步骤中执行的输出:
d:\workspace\test-job>powershell Get-ExecutionPolicy -list
Scope ExecutionPolicy
----- ---------------
MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser Undefined
LocalMachine Undefined
我还尝试从构建步骤中明确设置它,没有。
我错过了什么?