- $PSCmdlet.ShouldProcess("Target", "Action")
|Target||The resource being changed.|
|Action||The operation being performed. Defaults to the name of the cmdlet.|
$PSCmdlet.ShouldProcess() will also automatically write a message to the verbose output.
PS> Invoke-MyCmdlet -Verbose
VERBOSE: Performing the operation "Invoke-MyCmdlet" on target "Target of action"
Using existing static classes
Adding -WhatIf and -Confirm support to your cmdlet
This modified text is an extract of the original Stack Overflow Documentation created by following contributors
and released under CC BY-SA 3.0