I have a PowerShell script that needs to reference Bamboo Plan variables (the GUI page in Bamboo console that allows you to add variables).
What is the syntax I need to use in my PowerShell script for referencing Bamboo plan variables?
I have a PowerShell script that needs to reference Bamboo Plan variables (the GUI page in Bamboo console that allows you to add variables).
What is the syntax I need to use in my PowerShell script for referencing Bamboo plan variables?
Community moderators have prevented the ability to post new answers.
This is not well documented indeed - you need to replace dots with underscores, i.e. for a plan variable named your.plan.variable
, which you would reference in a regular Bamboo task as ${bamboo.your.plan.variable}
, the resp. PowerShell syntax for use within the Script task is $bamboo_your_plan_variable
.
Hi
Just to confirm. In my powershell script, I can use the following
$bamboo_abc (abc is defined in plan variables console)
I don't need brackets around it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Beau - yes, you don't need (and can't use) brackets around a variable in a PowerShell script, $bamboo_abc
is the only valid syntax for a plan variable defined as abc
.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Utoolity [OPS]
I tried the following command in powershell and it didnt work. The error tells me there's a syntax error.
net localgroup "Remote Desktop Users" /add "abc.com\$bamboo_ad_security_group_admin"
Any idea why it doesn't work?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Beau - yes, I think the variables only work within the immediate script context of the Script task, i.e. they are presumably injected with the PowerShell Script scope and you need to pass them via arguments from one script to another accordingly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Bamboo uses environment variables in windows so you can just use Get-Childitem env: to list all of them. Then access using something like $Env:bamboo_Account_Name
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.