Chapter 24. Advanced syntax for scripts and functions
This chapter covers
- Using advanced parameters
- Aliasing parameters
- Validating parameter input
- Using parameter sets
- Using common parameters
This is the chapter we’ve been waiting to get to. In it, we’re going to take almost everything from the prior chapters—writing scripts and functions, creating objects as output, using scope, and more—to the next level. In our minds, the advanced syntax we’ll cover in this chapter is something every script or function should eventually use. You’ll get an amazing amount of additional functionality and capability almost entirely for free, simply by giving PowerShell a few extra keywords here and there.
The type of script and function you’re going to build in this chapter is called an advanced script or advanced function, although many folks like to refer to them as script cmdlets, which was their first name during the PowerShell v2 beta process. As the name implies, you’ll be able to build something that looks, smells, feels, and tastes almost exactly like a real, native PowerShell cmdlet—and you won’t need a copy of Visual Studio to do it!