Using [switch] parameter and mandatory=$false together?

Here is an excerpt from my script:

[Parameter(Mandatory = $false)]

Do I need to do this, or does using the [switch] method basically make the “Mandatory=$false” attribute obsolete since using switch is basically telling it using the parameter would equal true, or not using it would make it false?


It doesn’t “automatically” make Mandatory=$false, but Mandatory=$false is the default for all parameters (never a reason to specify it, really), and Mandatory=$true is incompatible with [switch] from a functional perspective.

Okay, I thought $false was the default, but couldn’t recall.

Thanks Don