Chapter 7. PowerShell functions

7.1 Fundamentals of PowerShell functions
7.2 Declaring formal parameters for a function
7.3 Returning values from functions
7.4 Using simple functions in a pipeline
7.5 Managing function definitions in a session
7.6 Variable scoping in functions
7.7 Summary

Porcupine quills. We’ve always done it with porcupine quills.

Dilbert

In this chapter, we’ll begin looking at how to combine the features from the previous chapters into reusable commands. As you’ll recall from chapter 2, there are four types of PowerShell commands: functions, cmdlets, scripts, and external commands. Functions and scripts are the two command types that can be written in the PowerShell language. We’ll start with functions as they’re ...

Get Windows PowerShell in Action, Second Edition 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.