PowerTip: Use PowerShell to Hide Parameter From IntelliSense


Summary: Learn how to use Windows PowerShell to hide a parameter from IntelliSense.

Hey, Scripting Guy! Question How can I use Windows PowerShell to hide a parameter from IntelliSense?

Hey, Scripting Guy! Answer Introduced in Windows PowerShell 4.0, you can specify the DontShow attribute
           for the [parameter()] type to hide that parameter from IntelliSense:

Function Test-Something {

    [cmdletbinding()]

    Param (

        [parameter(DontShow)]

        $HiddenParameter,

        [parameter()]

        $Computername,

        [parameter()]

        $NewValue

    )

}

Cycling through parameters will not show $HiddenParameter:

PS C:> Test-Something - #Tab through parameters

Comments (3)

  1. Chen V says:

    Sorry just observed – It’s Boe Prox !

  2. Chen V says:

    @Ed Good to know about this option but why do we need to hide parameter? Please let us know if there is any advantage of this. Thanks in advance

  3. Chen V says:

    I am not really sure about the usage of this feature – Anyways this is my contribution to find DontShow value.

    New-Object System.Management.Automation.ParameterAttribute

    Position : -2147483648
    ParameterSetName : __AllParameterSets
    Mandatory : False
    ValueFromPipeline : False
    ValueFromPipelineByPropertyName : False
    ValueFromRemainingArguments : False
    HelpMessage :
    HelpMessageBaseName :
    HelpMessageResourceId :

    DontShow : False

    TypeId : System.Management.Automation.ParameterAttribute

Skip to main content