PowerTip: Look at User Variables


Summary: Look at variables that do not have a description.

Hey, Scripting Guy! Question How can you look at automatic and user-created variables that have no description?

Hey, Scripting Guy! Answer Use the Get-Variable cmdlet and search for an empty description:

            Get-Variable | where description -eq “”

Comments (2)

  1. Walid Toumi says:

    Hi ed,

    thank's for sharing,

    to set description:

    PS II> gv | ? { $_.description -eq '' -and $_.Name -eq 'this' }

    Name                           Value

    —-                           —–

    this

    PS II> gv | ? { $_.description -eq '' -and $_.Name -eq 'this' } |Set-Variable -Description 'current object'

    PS II> gv this  | select name,desc*

    Name                                                        Description

    —-                                                        ———–

    this                                                        current object

  2. Ed Wilson says:

    @Walid Toumi awesome! Yes, to set the variable description you can use Set-Variable. Thanks for sharing.

Skip to main content