Getting Parameter Properties

This topic contains 1 reply, has 2 voices, and was last updated by  Don Jones 11 months, 3 weeks ago.

  • Author
    Posts
  • #55055

    Greg Tate
    Participant

    I came across a cmdlet that has a ton of parameters. Instead of reading the help to determine the properties of each parameter, I'd like to filter properties in the console. As an example, I'd like to return parameters of a cmdlet that are only mandatory.

    How can I do that?

    Was thinking something on the order of what's shown below, but I'm not able to find what I'm looking for – and neither is Bono.

    Get-Command New-SelfSignedCertificate | 
    select-object -ExpandProperty Parameters | 
    where { $_.Mandatory -eq $true }
    

    I made up the property at the end of the pipeline so that my question would make more sense.

    • This topic was modified 11 months, 3 weeks ago by  Greg Tate.
    • This topic was modified 11 months, 3 weeks ago by  Greg Tate.
  • #55062

    Don Jones
    Keymaster

    It's "IsMandatory."

    Get-Command Get-ChildItem | Format-Custom *
    

    Is probably the easiest way to see the object structure, short of using Lee Holmes' Show-Object command from the powershellcookbook module.

You must be logged in to reply to this topic.