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!

24.1. Starting point

 
 
 

24.2. Advanced parameters

 
 
 

24.3. Variations on parameter inputs

 

24.4. Parameter aliases

 
 
 

24.5. Parameter validation

 
 

24.6. Parameter sets

 

24.7. WhatIf and Confirm parameters

 
 
 
 

24.8. Verbose output

 

24.9. Summary

 
 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest