Professional Documents
Culture Documents
Get-Command -Noun Variable # the Variable Cmdlets $Host Reference to the application hosting the $OFS Output Field Separator. Specifies
Get-ChildItem variable: # listing all variables using the POWERSHELL language the character that separates the
variable drive $Input Enumerator of objects piped to a script elements of an array when the
$LastExitCode Exit code of last program or script array is converted to a string. The
# strongly-typed variable (can contain only integers) $Matches Exit code of last program or script default value is: Space.
[int]$number=8 $MyInvocation An object with information about the $OutputEncoding Determines the character
current command encoding method that Windows
# attributes can be used on variables $PSHome The installation location of Windows PowerShell uses when it sends
[ValidateRange(1,10)][int]$number = 1 PowerShell text to other applications
$number = 11 #returns an error $profile The standard profile (may not be $PSDefaultParameterValues Specifies default values for the
present) parameters of cmdlets and
# flip variables $Switch Enumerator in a switch statement advanced functions
$a=1;$b=2 $True Boolean value for TRUE $PSEmailServer Specifies the default e-mail server
$a,$b = $b,$a $False Boolean value for FALSE that is used to send e-mail
$PSCulture Current culture messages
# multi assignment $PSUICulture Current UI culture $PSModuleAutoLoadingPreference Enables and disables
$a,$b,$c = 0 $PsVersionTable Details about the version of Windows automatic importing of modules
$a,$b,$c = 'a','b','c' PowerShell in the session. "All" is the default.
$a,$b,$c = 'a b c'.split() $Pwd The full path of the current directory $PSSessionApplicationName Specifies the default application
name for a remote command that
# create read only variable (can be overwritten with - Windows PowerShell Preference Variables uses WS-Management technology
Force) $PSSessionConfigurationName Specifies the default session
Set-Variable -Name ReadOnlyVar -Value 3 -Option $ConfirmPreference Determines whether Windows configuration that is used for
ReadOnly PowerShell automatically PSSessions created in the current
prompts you for confirmation session
# create Constant variable (cannot be overwritten) before running a cmdlet or $PSSessionOption Establishes the default values for
Set-Variable -Name Pi -Value 3.14 -Option Constant function advanced user options in a
$DebugPreference Determines how Windows remote session
Windows PowerShell Automatic Variables PowerShell responds to
(not exhaustive) $VerbosePreference Determines how Windows
debugging PowerShell responds to verbose
$$ Last token of the previous $ErrorActionPreference Determines how Windows messages generated by a script,
command line PowerShell responds to a non- cmdlet or provider
$? Boolean status of last command terminating error $WarningPreference Determines how Windows
$^ First token of the previous $ErrorView Determines the display format PowerShell responds to warning
command line of error messages in Windows messages generated by a script,
$_, $PSItem Current pipeline object PowerShell cmdlet or provider
$Args Arguments to a script or function $FormatEnumerationLimitDetermines how many $WhatIfPreference Determines whether WhatIf is
$Error Array of errors from previous enumerated items are included automatically enabled for every
commands in a display command that supports it
$ForEach Reference to the enumerator in a $MaximumHistoryCount Determines how many
foreach loop commands are saved in the
$Home The user’s home directory command history for the
current session
Windows PowerShell 3.0 Language Quick Reference
Created by http://powershellmagazine.com