How to know what all content is accepted by a parameter

This topic contains 3 replies, has 3 voices, and was last updated by  Sammy Boy 1 week, 2 days ago.

  • Author
    Posts
  • #83312

    Sammy Boy
    Participant

    Hey All,

    I'm still a beginner. Have been watching multiple videos and reading contents from website.

    So far, all I get to know that to get more detailed information about any cmdlets, you can use "Get-help %enter the cmdlet%" and they include "-full" or "-examples" or "detailed" etc.

    But, what I need is whether there are any ways to know what list of strings is accepted by a specific parameter after the cmdlets.

    Eg:
    Get-help ADPowershellWebAccess -Full
    —> This will give me full detailed information of the cmdlet ADPowershellWebAccess.

    But, what about this:
    Add-PswaAuthorizationRule -ConfigurationName
    —> Now, here I don't know what are the string(s) name which can be entered after -ConfigurationName parameter. Thus, is there anyway to list down all the strings which can be used after the parameter -ConfigurationName.

    I know.. I know.. I'm being silly but if I could get that information, that'll make my life better. And hope I make some sense.

    Peace & Cheers,
    Sammy Boy.

  • #83345

    tmack8080
    Participant

    -ConfigurationName
    Specifies the name of the Windows PowerShell session configuration, also known as runspace, to which this rule grants access.

    https://technet.microsoft.com/en-us/library/jj592890(v=wps.630).aspx

  • #83354

    Jeremy Murrah
    Participant

    If you're asking just about that particular parameter on that particular cmdlet check out these links for info on powershell configuration files:

    https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_session_configuration_files?view=powershell-5.1
    https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/new-pssessionconfigurationfile?view=powershell-5.1

    If you're asking more generally about how to find that info from the provided help file, then that is definitely in there. So in the case of that parameter it is a string value so just about anything will be "accepted", i.e. any string value will pass parameter validation. That doesn't necessarily mean it's valid for the use case, but powershell accepts it and runs the command.

    In some cases you may have a parameter that is a string value but only accepts one of a handful of options. This is done through a "validateset" parameter option behind the scenes, but should show up in the help syntax as well. Check out this example of get-aduser:

    NAME
        Get-ADUser
    
    SYNOPSIS
        Gets one or more Active Directory users.
    
    
    SYNTAX
        Get-ADUser [-AuthType {Negotiate | Basic}] [-Credential ] [-Properties ] [-ResultPageSize
        ] [-ResultSetSize ] [-SearchBase ] [-SearchScope {Base | OneLevel | Subtree}] [-Server
        ] -Filter  []
    
        Get-ADUser [-Identity]  [-AuthType {Negotiate | Basic}] [-Credential ] [-Partition ]
        [-Properties ] [-Server ] []
    
        Get-ADUser [-AuthType {Negotiate | Basic}] [-Credential ] [-Properties ] [-ResultPageSize
        ] [-ResultSetSize ] [-SearchBase ] [-SearchScope {Base | OneLevel | Subtree}] [-Server
        ] -LDAPFilter  []
    
    

    Note in particular this part from the first parameter set:

    [-SearchScope {Base | OneLevel | Subtree}]
    

    That is the help file's way of telling you the choices available for that particular parameter. Anything other than one of those three options will throw an error. Also that error message usually has the acceptable options listed so that can be another way to find out the values.

You must be logged in to reply to this topic.