PowerTip: Examine Automatic Variables

PowerTip: Examine Automatic Variables

  • Comments 3
  • Likes

Summary: Learn how to identify automatic variables.

Hey, Scripting Guy! Question How many types of automatic variables exist by default? And how would you discover such a thing?

Hey, Scripting Guy! Answer There are five types of automatic variables that exist by default.

To discover them, use the variable provider and the Get-Member cmdlet:

PS C:\> dir variable: -Force | gm | select typename | sort typename -Unique








Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Always helpful.

  • Vote +1 if you had to google what an automatic variable was.  

  • @Livio von Buren, great. I am glad you found it helpful.

    @Knuckle-Dragger, sorry about that. I am trying to walk a fine line with these PowerTips between a simple one line tip, and a full blown blog article. The good thing, is that now you know what an automatic variable is :-) By the way, I have written a lot of articles where I talked about automatic variables blogs.technet.com/.../searchresults.aspx