Summary
In this module, you've learned how to filter objects out of the pipeline by using the Where-Object cmdlet to specify various criteria. The following are the key takeaways:
- PowerShell comparison operators compare a particular property of an object to a value. They help inform PowerShell of the objects that need to be retained and those objects that need to be removed from the pipeline.
- The
Where-Objectcommand has basic and advanced forms of syntax (also called simplified syntax and scriptblock syntax in Microsoft documentation). Both forms support an extensive list of parameter sets—one for each comparison operator. - The advanced syntax of
Where-Objectuses a filter script, which is a script block that contains the comparison and that you pass by using the-FilterScriptparameter. - You can use the mnemonic filter left to remember the correct approach when you're optimizing performance.