Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9173791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:38:47+00:00 2026-06-17T16:38:47+00:00

Is there any restriction to the number of parameter sets a cmdlet can have?

  • 0

Is there any restriction to the number of parameter sets a cmdlet can have? I’ve made a cmdlet which has 56 switch parameters and I want each one to be mandatory in its own parameter set. For some reason powershell groups the (n+1)th with the 1st, the (n+2)th with the 2nd etc, ending up with no more than n parameter sets; if I counted correctly n was 32.
This is what my cmdlet looks like:

[Cmdlet(VerbsCommon.Get, "Foo")]
public class GetFoo : PSCmdlet
{
    [Parameter(ValueFromPipeline = true)]
    public string ParamA {get;set;}

    [Parameter(ValueFromPipelineByPropertyName = true)]
    public string ParamB {get;set;}

    [Parameter]
    public string ParamC {get;set;}

    [Parameter(ParameterSetName = "Group1", Mandatory = true)]
    public SwitchParameter Param1 {get;set;}

    [Parameter(ParameterSetName = "Group2", Mandatory = true)]
    public SwitchParameter Param2 {get;set;}
    . . .

    [Parameter(ParameterSetName = "Group56", Mandatory = true)]
    public SwitchParameter Param56 {get;set;}
}

Expected:

PS> Get-Help Get-Foo
  Get-Foo -Param1 [-ParamA <string>] [-ParamB <string>] [-ParamC <string>]
  Get-Foo -Param2 [-ParamA <string>] [-ParamB <string>] [-ParamC <string>]
  . . .
  Get-Foo -Param56 [-ParamA <string>] [-ParamB <string>] [-ParamC <string>]

Actual:

PS> Get-Help Get-Foo
  Get-Foo -Param1 -Param33 [-ParamA <string>] [-ParamB <string>] [-ParamC <string>]
  Get-Foo -Param2 -Param34 [-ParamA <string>] [-ParamB <string>] [-ParamC <string>]
  . . .
  Get-Foo -Param24 -Param56 [-ParamA <string>] [-ParamB <string>] [-ParamC <string>]
  Get-Foo -Param25 [-ParamA <string>] [-ParamB <string>] [-ParamC <string>]
  . . .
  Get-Foo -Param32 [-ParamA <string>] [-ParamB <string>] [-ParamC <string>]

I’m breaking my head and can’t see what’s wrong with the way I’ve constructeed the cmdlet; I don’t see this behaviour if I decrease the number of parametersets. Any tips would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:38:48+00:00Added an answer on June 17, 2026 at 4:38 pm

    It looks like there’s a limit of 32 ParameterSets per cmdlet. See if you can test it out by creating 65 parameter sets and see if -Param65 is in set 1 (with -Param1 and -Param33).

    A workaround would be to change your SwitchParameters into a Parameter that takes an Enum containing all of your switch values.

    Get-Foo -ParamD <EnumParams1To56> [-ParamA <string>] [-ParamB <string>] [-ParamC <string>]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way I can set a formatter on models that will convert
Is there any way we can fetch X509 Public Cetrificates using c# from AD
In my app, I have a User model, which includes a number of attributes
The standard seems to imply that there is no restriction on the number of
I have a jsp page in which there is a html table. The contents
I can't seem to find any documentation on this. Is there a limit to
Is there any way I can find how many objects are instantiated from stack
There are n items in a line. We have to find the number of
I'm wondering whether or not there are any restrictions during HBase minor/major compactions .
Is there any functional difference in Python between a try statement and an if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.