According Microsoft:
In rare cases, you might need to provide a Boolean value for a switch parameter. To provide a Boolean value for a switch parameter in the value of the File parameter, enclose the parameter name and value in curly braces, such as the following: -File .\Get-Script.ps1 {-All:$False}
I have a simple script:
[CmdletBinding()]
Param
(
[switch] $testSwitch
)
$testSwitch.ToBool()
Next I am trying to run it this way:
powershell -file .\1.ps1 {-testSwitch:$false}
As result I receive an error:

But if believe Microsoft it should work.
If I delete [CmdletBinding] attribute this error will not occur, but for some reasons $testSwitch.ToBool() returns False despite whether I pass $True or $False.
Why? What are the reasons of this behaviour?
