Filter Your Data

When you are dealing with collections of data, it is often necessary to filter that data down to either a specific result or a trimmed result set that can be used for reporting purposes. Windows PowerShell provides three key cmdlets that facilitate filtering data, sorting data, and finally, selecting specific attributes of an object:

  • Where-Object
  • Sort-Object
  • Select-Object

Use the Where-Object Cmdlet

The Where-Object cmdlet, aliased as where and ?, is perhaps the most useful cmdlet of the three, particularly when working with SharePoint data. This cmdlet takes input from the pipeline and filters that input based on a conditional expression. The conditional expression is written using a script block. The parameters for the

Get Automating Microsoft® SharePoint® 2010 Administration with Windows PowerShell® 2.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.