O'Reilly logo

Learn PowerShell Scripting in a Month of Lunches by Don Jones and Jeffery Hicks

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 11. Going advanced with your function

In this chapter, we’ll focus entirely on the Param() block of the example function and discuss some of the cool things you can do with it.

11.1. About CmdletBinding and common parameters

Back when PowerShell v2 was being developed, Microsoft toyed with the idea of having a cmdlet{} construct that was essentially a superset of function{}. The idea was that these “script cmdlets” would exhibit all the behaviors of a “real” cmdlet (for example, one written in .NET and compiled into an assembly). By the time v2 released, these had become advanced functions, and they’re differentiated primarily by the [CmdletBinding()] attribute. To illustrate the first major difference, let’s start with a basic function: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required