Jenkins executes PowerShell scripts

I am trying to run PowerShell scripts from Jenkins, but it seems to completely ignore the execution policy! This happens either by directly executing powershell.exe, or using the PowerShell plugin

Additional Information:

Jenkins runs as a Windows service (using a Local System account, not interactive). Connecting to this server and checking the execution policy is valid RemoteSigned:

PS C:\> whoami
nt authority\system

PS C:\> Get-ExecutionPolicy
RemoteSigned
PS C:\>

However, when starting the Jenkins build, this is not the case. Here's the execution output Get-ExecutionPolicy -Listinside the build step:

d:\workspace\test-job>powershell Get-ExecutionPolicy -list 
  Scope                         ExecutionPolicy
  -----                         ---------------
  MachinePolicy                 Undefined
  UserPolicy                    Undefined
  Process                       Undefined
  CurrentUser                   Undefined
  LocalMachine                  Undefined

I also tried installing it explicitly from the build stage, nothing.

What am I missing?

+4
1

, x86/x64!!!

, Set-ExecutionPolicy x64 ( ) PowerShell x86!

Jenkins - 32- , Windows - x86 PowerShell!

, x86 PowerShell %systemroot%\SysWow64\WindowsPowerShell\1.0\Modules, , !

+8

Source: https://habr.com/ru/post/1546843/


All Articles