Common Parameters and Optional Common Parameters

by Sep 4, 2015

Cmdlets and advanced PowerShell functions can have their own parameters, but they also always inherit common parameters.

To see a list of common parameters, try this:

 
PS> [System.Management.Automation.Cmdlet]::CommonParameters
Verbose
Debug
ErrorAction
WarningAction
ErrorVariable
WarningVariable
OutVariable
OutBuffer
PipelineVariable
 

The result can be different, depending on your PowerShell version. In PowerShell 5.0, two new common parameters were added.

Some cmdlets may have additional optional common parameters. To list these, try this:

 
PS> [System.Management.Automation.Cmdlet]::OptionalCommonParameters
WhatIf
Confirm
UseTransaction 
 

Twitter This Tip! ReTweet this Tip!