Exploring PowerShell Automatic Variables

by Feb 29, 2016

Here is an easy way to get a list of all currently defined variables, their values, and their purpose.

#requires -Version 2

Get-Variable | 
  Select-Object -Property Name, Description, Value |
  Out-GridView

If you'd like to set a description for your own variables, too, use Set-Variable:

 
PS C:\> $a = 1

PS C:\> Set-Variable -Name a -Description 'Some test variable' 
 

Twitter This Tip! ReTweet this Tip!