I have a PowerShell script that is pulled from a repo. It accepts the following parameters:
param(
[Parameter(Mandatory=$True)]
[string]$arg1,
[Parameter(Mandatory=$True)]
[string]$arg2,
[Parameter(Mandatory=$True)]
[string]$arg3,
[Parameter(Mandatory=$True)]
[string]$arg4,
[Parameter(Mandatory=$False)]
[string]$arg5 = '$false'
)
I'd like $arg5 to be a switch type, but I think that Bamboo only allows strings to be passed in. In my task, I have the following being passed in as arguments:
${bamboo.arg1} ${bamboo.arg2} ${bamboo.arg3} ${bamboo.arg4} "1"
The "1" would be converted to a boolean value. I've also tried it with "`$true", '$True, $true, etc etc. I've even tried strings that would fail on the boolean conversion, such as "WHY" and "WHAT IS GOING ON". All values result in this error:
"A positional parameter cannot be found that accepts argument '<value I passed in>'."
Interestingly, I also made the last parameter mandatory and didn't pass it in, and it still runs successfully. What am I missing? It runs perfectly well from PS if I call the script directly, but Bamboo will not accept the parameter.