Looping Through Code
A fundamental concept in any programming language is the use of looping techniques. Because everything in Windows PowerShell is an object, looping techniques not only become much more important but also are inherent in the way you use the scripts. Most of the time, you will not have to stop and think, "Do I need to use a looping technique here?" Rather, it will be intuitive, and you will probably find yourself performing the looping without thinking.
Using the ForEach-Object Cmdlet
If you were tempted to call this the for … each … next statement (as it was called in VBScript), then I have good news for you. In Windows PowerShell, there is no "next" required for the ForEach-Object cmdlet. Therefore, you will never forget to close ...
Get Microsoft® Windows PowerShell™ Step By Step 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.