Summary

Completed

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-Object command 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-Object uses a filter script, which is a script block that contains the comparison and that you pass by using the -FilterScript parameter.
  • You can use the mnemonic filter left to remember the correct approach when you're optimizing performance.