The whole point of PowerShell is to automate administration, and that often means you’ll want to perform some tasks with multiple targets. You might want to start several VMs, push to several blob storages, modify permissions of several users, and so on. In this chapter, you’ll learn two distinct techniques for accomplishing these and other multiple-target tasks: batch cmdlets and object enumeration. The concepts and techniques here are the same regardless of the OS you’re using.
Note
As you’ve learned in several previous chapters, many PowerShell cmdlets can accept batches, or collections, of objects to work with. In chapter 6, for example, you learned that objects can be piped from one cmdlet to another, like this (please don’t run this on any system, unless you really want to have a bad day):
Get-Service | Stop-Service