PowerTip: Use PowerShell to Hide Parameter From IntelliSense

Doctor Scripto

Dr Scripto

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

Doctor Scripto
Dr Scripto

Scripter, PowerShell, vbScript, BAT, CMD

Follow Dr Scripto   

0 comments

    Leave a comment