Today we are going to talk about the Automatic Variables that PowerShell provides for us. Automatic variables are provided by the PowerShell Team to allow us to grab key scripting functions. I commonly use $False, $True, and $Pwd in my scripts. To get a list of all the Automatic Variables we need to run
get-help about_automatic_variables. You might have to run
Update-Help before running the
The following variables are just some of the most used:
$Event - "Contains a PSEventArgs object that represents the event that is being processed." $False - "Contains FALSE." $Home - "Contains the full path of the users home directory." $NULL - "Contains a NULL or empty value." $PID - "Contains the process identifier (PID) of the process that is hosting the current Windows PowerShell session." $PsCmdlet - "Contains an object that represents the cmdlet or advanced function that is being run." $PSScriptRoot - "Contains the directory from which the script module is being executed." $PsHome - "Contains the full path of the installation directory for Windows PowerShell." $PSVersionTable - "Contains a read-only hash table that displays details about the version of PowerShell that is running in the current session." $Pwd - "Contains a path object that represents the full path of the current directory." $True - "Contains TRUE."