PowerShell Where-Object | Super Easy Object Filtering

Mark Harwood
3 min readOct 1, 2024

Morning everyone! I wanted to revisit a root topic of mine: Windows PowerShell!

If you used the PowerShell Where-Object cmdlet, you know just how critical it is to learn. In my opinion, it’s one of the most versatile and widely used cmdlets in PowerShell.

So today, I wanted to give a more in-depth overview on what Where-Object is and how to use it properly.

Before we start, you can also read this on my website!

What is PowerShell Where-Object?

Reading from the definition: The Windows PowerShell where-object takes in objects from the pipeline and filters them based on a condition specified in the script block.

What what does that actually mean?

I think it’ll be easier to show you graphically. Below is an image which shows Where-Object in it’s most basic form:

Where-Object { <condition> }

Where you have the input on the left, this would be another command inside PowerShell. Where-Object in the middle which takes in the output from the previous command. And finally the filtered output on the right.

Why Use PowerShell Where-Object?

--

--

Mark Harwood
Mark Harwood

Written by Mark Harwood

IT Pro 👨‍💻 Dad 👀 Husband🔒 Check out my free blog or utilise my expertise on the web! https://mharwood.uk