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.

Practical PowerShell Series: Part 2


When working on PowerShell scripts, there might come a point where a set of instructions is – in small or larger form – a repeat of code that occurs elsewhere in the script. Or it might be code you used in another script or sourced from other locations, and you want to incorporate it into your script to easily call the code.

In the second installment of the Practical PowerShell series, I will discuss how to leverage code’s reusability through functions and scripts.

Among the topics discussed are:

  • (Advanced) functions, including custom parameters, common parameters, and typing.
  • Adding helpful instructions so your script and functions become documenting.
  • Pipeline processing.

Click here to read the full article on Practical 365.

Practical PowerShell Series


“How do I start using scripting?” or “How do I turn this piece of code into a fully working script?” These are just some of the questions that reach me through mail or during events. Even after 17 years since its introduction with Exchange Server 2007, there is still a gap regarding PowerShell. Not all administrators are natural developers, despite Microsoft expecting them in some ways. Some may need more help in this area.

To address this need, I am starting a series of PowerShell-related articles on Practical 365. I will be covering skills needed when going from a piece of code or concept to a script with all major bells and whistles. I will also throw in best practices and the occasional tip. The series aims to help this target audience improve their skills using practical examples. Note that practical is the keyword here, as I am trying to start theoretical or aesthetic discussions on code layout or which style is better.

Click here to read the full article on Practical 365.