Chapter 21. Creating your own “cmdlets” and modules

At the end of chapter 19, you saw how to make a function (in listing 19.5) that output custom objects to the pipeline. Mastering that kind of output is a key to becoming a PowerShell guru, but there’s also the question of input.

In chapter 19, we passed input to the function by means of a parameter. In this chapter, we’re going to look at some other means of getting input into the function. By combining different input techniques with what you already know about producing output, you’ll find that you can create a tool that behaves almost exactly like a PowerShell cmdlet!

21.1. Turning a reusable tool into a full-fledged cmdlet

As I said, the function in listing 19.5 accepted input primarily ...

Get Learn Windows PowerShell in a Month of Lunches 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.