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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,558,797
Community Members
 
Community Events
184
Community Groups

Getting an error when running Powershell inline script

can't seem to run powershell inline script in bamboo.  I keep getting this error after setting up a new bamboo agent:

Failing task since return code of [powershell -ExecutionPolicy bypass -Command D:\bamboo-agent-home\temp\ID-TP-JOB1-47-ScriptBuildTask-7318819736850637125.ps1] was -1 while expected 0

2 answers

1 accepted

0 votes
Answer accepted
Omar Herrera
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Dec 27, 2018

Hi @Hector Magnanao please check the environment variable PATH have the windows  powershell exe 

C:\Windows\System32\WindowsPowerShell\v1.0\

 

For test purpose you can add a new task with this inline cmd script

SET 
powershell -Command "$PSVersionTable.PSVersion"

This code show the path variables for you agent.

Cheers.

Omar H.

Omar,

 

This is already fixed.  Thanks for your suggestion.

Hi Omar,

This error seems to come back again with a new bamboo agent.  I tried that command above but it gives me this error:

Unable to find executable at cmd.exe. Will try to run it anyway.
'powershell' is not recognized as an internal or external command,
operable program or batch file.

For those who are wondering, I also had this issue on a Windows 2016 box, with bamboo agent running as a non-interactive service, using the java wrapper.exe. On that machine, the system %PATH% was not being loaded for a domain user account which was being used to run the service. I got things working by modifying the wrapper.conf (referenced on the command line for the win service) to include the following lines:

set.default.MYPATH=%PATH%%WRAPPER_PATH_SEPARATOR%C:\Windows\System32\WindowsPowerShell\v1.0\%WRAPPER_PATH_SEPARATOR%
set.PATH=%MYPATH%

These statements should be on two lines. I used a temporary variable due to a bug mentioned in https://wrapper.tanukisoftware.com/doc/english/props-envvars.html

This may be a hack. I'm not sure what the proper way of injecting the system PATH into a service context is, if any.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events