Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How can I execute a PowerShell Script from the Script task in a Bamboo job?

Devi Nair
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 3, 2022

I need to execute a PowerShell script in Bamboo. Below are the steps I did:

  • Add task in a Job - 'Script' Task
  • Selected the Interpreter as 'PowerShell'
  • Tried Script locations as both inline and File (using Inline, tried to run Write-Host command). Using File, I tried executing a .sh script (which build successfully in the same bamboo agent when run directly using PowerShell in admin mode in that machine)

Note : the build agent is a windows machine

The task failing with error - 

Failing task since return code of [powershell -NonInteractive -ExecutionPolicy bypass -Command d:\bambooagent\temp\MER-BPMUI-JOB1-33-ScriptBuildTask-7361736628996142855.ps1] was -1 while expected 0

The PowerShell Execution policy of the build agent machine is 

Scope                      ExecutionPolicy
-----                         ---------------
MachinePolicy         Restricted
UserPolicy                Restricted
Process                    Undefined
CurrentUser             Unrestricted
LocalMachine          Unrestricted


I am blocked in this step. Looking for urgent assistance on this. What needs to be done? 

0 answers

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events