views:

102

answers:

1

In C# you can get the current ParameterSetName in the ProcessRecord override of a PowerShell Cmdlet with code like this:

 switch (ParameterSetName)
 {
      case FromUriParamSetName:
           loadFromUri();
           break;

      case FromFileParamSetName:
           loadFromFile();
           break;
 }

I'm trying to figure out how I can get the value for ParameterSetName in a script cmdlet (Advanced Function).

+2  A: 

Use $PsCmdlet.ParameterSetName:

switch ($PsCmdlet.ParameterSetName) {
    "FromFile_ParamSet" {

    }
    "FromUri_ParamSet" {

    }
}
spoon16