Q. What is CmdletBinding()?
May 31, 2010
A. In PowerShell, you can run
help about_functions_advanced
to learn more about what some folks call "script cmdlets," which use the CmdletBinding() attribute. Essentially, this attribute tells the shell to attach various attributes to the parameters of a function, such as making the parameter mandatory, tagging it for pipeline parameter binding, or specifying various input validation rules for the parameter's values. By using CmdletBinding() in your function, you can also declare support for the -whatif and -confirm switches, among other capabilities.
Do you have a Windows PowerShell question? Why not submit it to Don? Post your question at www.windowsitpro.com/FAQs/FAQSubmittalForm.aspx and you might see your answer online! Find more PowerShell FAQs, articles, and other resources at windowsitpro.com/go/DonJonesPowerShell.
About the Author
You May Also Like