Practical PowerShell Series: Part 3

When working with PowerShell and objects such as User in Entra ID or mailboxes in Exchange Online, you might quickly run into scenarios where you might want to repeat a set of instructions for multiple objects. This can happen for example, when configuring mailbox properties for multiple mailboxes. This construct of flow control is called looping.

In the third installment of the Practical PowerShell series, I discuss which types of looping are available in PowerShell and what their typical application is. Topics discussed are For loops, ForEach-Object vs ForEach, and While/Do-While and Do-Until. On the side, I will also touch briefly on casting, the format operator, and running code in parallel using ForEach-Object.

Click here to read the full article on Practical 365.

This entry was posted in PowerShell and tagged , , by Michel de Rooij. Bookmark the permalink.
Unknown's avatar

About Michel de Rooij

Michel de Rooij is a Microsoft MVP, architect, author, and speaker with over 25 years of experience in Microsoft messaging, identity, and collaboration technologies. He specializes in Microsoft Exchange, Exchange Online, and email security, with a strong focus on architecture, migration, automation, and practical solutions. Michel has authored several Microsoft Exchange books, including Pro Exchange Server Administration, and contributes to the Office 365 for IT Pros series. A Microsoft MVP since 2013, he regularly shares his knowledge, tools, and real-world experience with the Microsoft community.

Leave a Reply