May 2022
Beginner
360 pages
10h 10m
English
Looping (or going through a list of objects one at a time) is a fundamental concept in any language, and PowerShell is no exception. There will come a time when you will need to execute a block of code numerous times. PowerShell is well equipped to handle this for you.
This section may be a bit confusing, as there is a difference between Foreach and Foreach-Object. Take a look at figure 23.1 for a visual representation of how Foreach works.

Figure 23.1 Diagram of how Foreach works
Probably the most common form of looping is the Foreach command. Foreach allows you to iterate ...