Exchange 2010 Powershell command to check if an email address exists in the system

Solution 1:

Get-Recipient -Identity [email protected]

This will return the recipient object for whoever has the given email address (including aliases). Since emails are guaranteed to be unique this should never return more than one record (I believe).

Get-Recipient -ANR user

You can use -ANR to search using Ambiguous Name Resolution (so you can type their first, last, username, etc), but while ANR will match a user's primary email address, it will not match their other SMTP aliases. ANR can return multiple matches (so ensure your code handles this case).

Get-Mailbox is not sufficient to confirm that an email address is unique, as it will not necessarily return contacts, or records from external or legacy systems. It returns mailboxes... and while all mailboxes have an email address, not all email addresses are a mailbox.

Solution 2:

This should do the trick:

get-mailbox -an [email protected] 

Solution 3:

I realize this is a bit old, but just solved the issue by running the following:

Get-Mailbox | %{$_.EmailAddresses | ?{$_ -like "*<email address>*"}}
Get-DistributionGroup | %{$_.EmailAddresses | ?{$_ -like "*<email address>*"}}
Get-MailPublicFolder | %{$_.EmailAddresses | ?{$_ -like "*<email address>*"}}

If anything was returned by any of them, it wouldn't necessarily tell me WHAT account was using it, but, I could then focus on which of the three returned a record to dive deeper. If nothing is returned, then it's not being used.