Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

PowerTip: Use PowerShell to Hide Parameter From IntelliSense

$
0
0

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


Viewing all articles
Browse latest Browse all 3333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>