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?