PowerTip: Examine Automatic Variables

Doctor Scripto

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

TypeName

——–

System.Management.Automation.LocalVariable

System.Management.Automation.NullVariable

System.Management.Automation.PSVariable

System.Management.Automation.QuestionMarkVariable

System.Management.Automation.SessionStateCapacityVariable

0 comments

Discussion is closed.

Feedback usabilla icon