Influence on write-verbose
One effect of annotating a function with
[CmdletBinding()] is that the
write-verbose cmdlet is enabled.
In the following example, the invocation of wv-with … -verbose prints the value of $p while the invocation of wv-without … -verbose does not have (any visible, at least) effect:
function wv-with {
[cmdletBinding()]
param($p)
write-verbose "param is $p"
}
function wv-without {
param($p)
write-verbose "param is $p"
}
wv-with XYZ
wv-with XYZ -verbose
wv-without XYZ
wv-without XYZ -verbose