Hudson will not run Powershell scripts with the Powershell plugin

There was a problem running Powershell scripts from the Hudson CI server using the Powershell plugin. I am running:

  • Hudson v1.362
  • Windows 2003
  • Powershell 1.0

I am trying to use the Powershell plugin for Hudson. Everything I try just gives me:


File C:\DOCUME~1\SVC_PR~1\LOCALS~1\Temp\hudson2144883754471568213.ps1  
  cannot be loaded because the execution of scripts is disabled on this system.

I set it ExecutionPolicyas " Unrestricted", but still getting the same message in Hudson.

  • Tried to restart Hudson - did not decide.
  • I tried putting " Set-ExecutionPolicy Unrestricted" in the Powershell profile of an account launched by Hudson, which only succeeded in giving me the above message twice, and not once (ironically)
  • "Powershell -ExecutionPolicy Unrestricted".
    : "Missing expression after unary operator '-'. At line:1 char:2 + -ExecutionPolicy Unrestricted" - , Powershell 1 -ExecutionPolicy v1.

, . , Powershell Poweshell, .

+3
4

. Powershell v2, , . 100%, , Powershell, Powershell Hudson, .

, , .

+1

Hudson PowerShell Plugin , script

" powershell.exe "& 'script.ps1'" "

script (RemoteSigned Unrestricted)

0

, Hudson CI Server , , . , . , , , . , PowerShell 2.0 comand ( 1.0).

, GPO reg:

HKLM\Software\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell 

ExecutionPolicy "RemoteSigned" "Unrestricted"

0
source

For someone else addressing this issue, one of the solutions I came up with was to execute a standard batch window command from a Jenkins job that sets up an execution policy:

powershell.exe -command set-executionpolicy unrestricted

For some reason, the policy used by Jenkins redefined the generally binding policy. Running set-executionpolicy from Jenkins was a quick way to make sure that a policy specific to the Jenkins environment was set.

0
source

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


All Articles