Which parameter set has been used?

I've used advanced parameter handling to support multiple parameter sets. Is there any pre-defined variable or way to determine which parameter set has been used to call the script?

e.g. something like

if($parameterSet -eq "set1") { ... } elseif ($parameterSet -eq "set2") { ... }

?


Solution 1:

Check the $PSCmdlet variable:

$PSCmdlet.ParameterSetName

Solution 2:

You can check in your script:

$PsCmdlet.ParameterSetName