Chapter 2. Reusable Advanced Functions and Scripts

In the first chapter, we revisited PowerShell and PowerCLI basics. Then, we discussed how we could use the GitHub version to control our work and collaborate with others to work on the same project. We also learned how to use Pester to do unit testing on our work. In this chapter, we are going to cover advanced functions and their implementations in PowerShell. Specifically, we are going to talk about the following topics:

  • Specifying function attributes
  • Specifying parameter attributes
  • Using parameter validation attributes
  • Using dynamic parameters
  • PowerShell help files
  • Creating comment-based help
  • Error handling in PowerShell

Before we start discussing advanced functions, let's take a look at normal functions. ...

Get Mastering PowerCLI now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.