PowerTip: Look at User Variables

PowerTip: Look at User Variables

  • Comments 2
  • Likes

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

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • 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.