Use the –Filter, Luke

Quite often, I see questions like “Why is my Get-Recipient command so slow?”, with a syntax like:

$user1 = Get-Recipient -ResultSize unlimited `
|Where-Object {$_.emailaddresses -eq `

You would think that would work lickity split, because there is only 1 result, me.

Ah, not so fast, grasshopper.  We are doing client side filtering – all recipients are returned by the Get-Recipient call, and THEN we pass those objects to the Where-Object.

On my Exchange 2007 system, this takes over a minute to return my information in $user1

So, I did some research, and read about –Filters and doing server side filtering: and

Modifying my script to use the –Filter produces results in less than 1 second:

$user2 = Get-Recipient -Filter `
{EmailAddresses -eq ‘’}

I suggest that you check for the –Filter parameter for any cmdlet that you use, and learn its syntax!

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: