When you create a Powershell script or function, you are able to add the [CmdletBinding()]
attribute in order to gain certain default parameters for use (e.g. -Verbose
, -Debug
, etc.) without having to define them yourself. In some cases you can add additional parameters to CmdletBinding
, like SupportsShouldProcess
or ConfirmImpact
to further add additional supported parameters or change the cmdlet behavior.
Is it possible to define your own CmdletBindings
for use within a module?
Is it possible to define your own
CmdletBindings
for use within a module?
Not in a script anyways :)
The CmdletBinding
attribute properties are processed by this method in the CommandMetadata
API immediately prior to compilation of whatever scriptblock or function has it, so you'd have to rewrite parts of the language engine itself in order to modify its behavior.