Functions can be described as building blocks in PowerShell. Functions are used to break up code into manageable sections. A function should strive to be good at one job. Functions are often used to build scripts; the script uses functions as a means of concisely describing the steps it is taking. Functions are often grouped together in modules. The functions within a module often share a common purpose or act on a single system. A filter is a specialized function, and are briefly explored in this chapter as they have been part of PowerShell since version 1.
This chapter explores the following topics:
- Introducing scripts, functions, and filters
- Begin, Process, and End
- Param, parameters, and CmdletBinding
- ShouldProcess and ShouldContinue