Hello,
I’m trying to pass either an array or hash into Powershell from CruiseControl.net; I’m constrained on the way it is called based on how it’s hardcoded into the PowershellTask. I need to basically make this work when executed from cmd or ccnet.
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -nologo -NoProfile -NonInteractive -file "C:\Test\Input.ps1" -Environment test -Overrides @{'asd'='net';'arguments'='broken'}
In the script I’ve got:
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true)]
[String]$Environment,
[Parameter(Mandatory=$false)]
[Hashtable]$Overrides = @{}
)
When I try that command (through CMD or cc.net) I get:
: Cannot process argument transformation on parameter 'Overrides'. Cannot convert the "@{'asd'='net';'arguments'='broken'}" value of type "System.String" to type "System.Collections.Hashtable".
If I switch from -File to -Command it works. Unfortunately the -File is hardcoded in CCNet so I can’t change it.
I don’t understand why it doesn’t work, and why the behaviour is different between -File and -Command.
Is what I want even possible?
Thanks,
Rob