No, it still won’t work. It seems that TC will always treat the value as a string no matter what. Maybe the answer was from the TC version that allowed this, but in the latest version this is not.
Without a colon:
[16:18:37]Step 1/6: Migrate Up (Powershell) [16:18:37][Step 1/6] PowerShell Executable: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe [16:18:37][Step 1/6] PowerShell arguments: [-NonInteractive, -ExecutionPolicy, ByPass, -File, C:\BuildAgent\work\f2797fec10821a01\data\Migration\MigrateUp.ps1, "data\change scripts", DB, xxxxxxx, sa, *******, -NoExec, $false] [16:18:37][Step 1/6] C:\BuildAgent\work\f2797fec10821a01\data\Migration\MigrateUp.ps1 : A positional parameter cannot be found that accepts argument '$false'.
With a colon:
[16:18:37]Step 2/6: Migrate Up (Powershell) [16:18:37][Step 2/6] PowerShell Executable: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe [16:18:37][Step 2/6] PowerShell arguments: [-NonInteractive, -ExecutionPolicy, ByPass, -File, C:\BuildAgent\work\f2797fec10821a01\data\Migration\MigrateUp.ps1, "data\change scripts", DB, xxxxxx, sa, *******, -NoExec:$false] [16:18:37][Step 2/6] C:\BuildAgent\work\f2797fec10821a01\data\Migration\MigrateUp.ps1 : Cannot process argument transformation on parameter 'NoExec'. Cannot convert value "System.String" to type "System.Management.Automation.SwitchParameter". Boolean parameters accept only Boolean values and numbers, such as $True, $False, 1 or 0.
Removing [switch] also does not work, since any value you give it will not be treated as a logical one, but rather a string assigned to a logical one - and therefore all logical operations will be $true .
In other words, everything you submit will look like this:
- 0 => '0'
- 1 => '1'
- $ false => '$ false'
- $ true => '$ true'
(none of them are == $false , but they are all equivalent to $ true)
I have no idea how to get TC to accept booleans! Best of all, I could assume that the argument was a string and use System.Convert.ToBoolean () inside my script ...