Common Parameters

noun

say it: “KOM-un puh-RAM-uh-terz” /ˈkɑmən pəˈræmətɚz/

The parameters every PowerShell cmdlet and advanced function has without listing them, such as -Verbose and -ErrorAction.

What are the common parameters in PowerShell?

The common parameters come free with every cmdlet and every advanced function: -Verbose, -ErrorAction, -WarningAction, -ErrorVariable, -OutVariable and a few more. You never write them in param(); [CmdletBinding()] adds them, and a help page's syntax line sums them up as [<CommonParameters>].

function Get-Song {
    [CmdletBinding()]
    param([string]$Mood)
    Write-Verbose "Looking for $Mood songs"
}
Get-Song -Mood Chill -Verbose   # VERBOSE: Looking for Chill songs

In a sentence

  • “-Verbose and -ErrorAction are common parameters.”
  • “After [CmdletBinding()], Get-Song had the common parameters too.”

Level: Journeyman · More PowerShell terms at this level

Updated