Iga*_*nik 4 windows powershell jenkins jenkins-plugins executionpolicy
我正在尝试从Jenkins运行PowerShell脚本,但它似乎完全忽略了执行策略!这可以通过直接执行powershell.exe或使用PowerShell插件来实现
附加信息:
Jenkins作为Windows服务运行(使用本地系统帐户,非交互式).确实连接到该服务器并检查执行策略RemoteSigned
:
PS C:\> whoami
nt authority\system
PS C:\> Get-ExecutionPolicy
RemoteSigned
PS C:\>
Run Code Online (Sandbox Code Playgroud)
但是,在运行Jenkins构建时,情况并非如此.这是在Get-ExecutionPolicy -List
构建步骤中执行的输出:
d:\workspace\test-job>powershell Get-ExecutionPolicy -list
Scope ExecutionPolicy
----- ---------------
MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser Undefined
LocalMachine Undefined
Run Code Online (Sandbox Code Playgroud)
我也尝试从构建步骤中明确设置它,没有.
我错过了什么?
Iga*_*nik 11
经过两个多小时拉我的头发,问题是x86/x64!
原来,Set-ExecutionPolicy
x64(默认)PowerShell对x86设置没有影响!
Jenkins是一个32位进程,从Windows服务运行 - 它执行x86 PowerShell!
另外,x86 PowerShell的Modules目录位于%systemroot%\SysWow64\WindowsPowerShell\1.0\Modules
另一个重要的事实要记住!
归档时间: |
|
查看次数: |
4028 次 |
最近记录: |