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.


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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.