Which parameter set has been used?

D.R. picture D.R. · Apr 2, 2013 · Viewed 13.7k times · Source

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") { ... }

?

Answer

Shay Levy picture Shay Levy · Apr 2, 2013

Check the $PSCmdlet variable:

$PSCmdlet.ParameterSetName