Q. What is CmdletBinding()?

Don Jones

May 31, 2010

1 Min Read
ITPro Today logo

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.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like