I am trying to use PowerShell scripts as part of a custom build job. The PS script is started but never ends. I have read that PS can't be called directly from Bamboo. I did get this to work using a batch file to launch PowerShell but this seems a poor solution.
I have found this solution is less reliable with Bamboo 5.1. Instead I've created a small bat file which is where my 'powershell' executable now points to. It contains:
REM http://serverfault.com/questions/437504/why-does-psexec-hang-after-successfully-running-a-powershell-script SET ps=C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe C:\Windows\System32\cmd.exe /c "echo . | %ps% -NonInteractive -ExecutionPolicy Unrestricted -File D:\%1.ps1 %2 %3 %4 %5 %6"
Then I have a number of powershell scripts in the same folder including an all-purpose one called Exec.ps1 which contains:
param([string]$command) #replacement for -command "some-power-shell-stuff" < NUL invoke-expression $command
I tried creating a batchfile (see below) where the argument is the PS script file. This works but task completes before the script does. The department seems heavily invested in Powershell but I'd be open to hearing other scripting solutions.
C:\Windows\System32\cmd.exe /c "echo aaa | C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe %*"
Still have issues getting error codes returned to bamboo. I have created a batch file and configure it as a global command:
C:\Windows\System32\cmd.exe /c "echo aaa | C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe %*; exit $LASTEXITCODE"
But still no exitcode in sight - any hints?
Badges are a great way to show off community activity, whether you’re a newbie or a Champion.Learn more
Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs