How do you search/find email addresses in Exchange 2007 using wildcard?
Well, Exchange Management Console has capability to filter recipients but it has limited power hence while working in enterprise or big environment when you want to find all kind of recipients, indeed PowerShell gives enrich direction with efficient search terms.
Let’s start with an example, below Exchange Management Shell CmdLet to find all email addresses which are still have smtp address of an old domain.
Get-Recipient -Filter "EmailAddresses -like ‘*@OldDomain.com’"
- Above CmdLet searches…
- All recipients (including User Mailbox, Mail User, Mail Contact, Universal/nonUniversal Secruity/Dist Group, Dynamic Distribution Group and Public Folders)
- All the email addresses (including primary, secondary, x400, x500, sip or any custom)
- You can add more search terms by appending –AND / –OR logical expression in filter switch to find more specific recipients as per your requirement…
Get-Recipient -Filter "EmailAddresses -like ‘*@OldDomain.com’ -And RecipientType -eq ‘UserMailbox’"
Get-Recipient -Filter "EmailAddresses -like ‘*@OldDomain.com’ -And Office -eq ‘OfficeName’"
- You can add -ResultSize Unlimited switch to eliminate default display limit of 1000 recipients in EMS.
Get-Recipient -ResultSize Unlimited -Filter "EmailAddresses -like ‘*@OldDomain.com’"
- And at last, you can use Get-Recipient cmdlet to search any AD attribute [not only email addresses :) ] which is being picked up. Check out below article for list of properties can be filtered with this cmdlet.
Hope this helps you to search in Enterprise Exchange environment…!!!