PowerTip: Look at User Variables

PowerTip: Look at User Variables

Rate This
  • Comments 2

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 ""

Leave a Comment
  • Please add 1 and 6 and type the answer here:
  • Post
  • 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

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

Page 1 of 1 (2 items)