Use Server-Side Queries

by May 4, 2010

If you'd like to speed up things, you should try to filter server side instead of client side whenever you query information. For example, this line will get you all warnings from an event log:

Get-EventLog System |
Where-Object { $_.EntryType -eq 'Warning' }

However, this line is inefficient and will take a long time to run because it actually queries all events and only then filters out the ones you are seeking. A much better (and faster) way is to use the cmdlet parameters to tell it right away what you want:

Get-EventLog System -EntryType Warning

Twitter This Tip! ReTweet this Tip!