Find any E-Mail Address or Proxy Address In Active Directory

Here is another common request for any Exchange or Unified Communications administrator. Someone will usually pop by and ask, “Who has this e-mail address?” The address could be one of many different types of objects. A user mailbox, shared mailbox, distribution list, public folder, contact or resource could all contain that specific e-mail address. The problem with the Exchange Management Console in Exchange 2010 does not allow you to find any e-mail address only the primary. The Exchange 2013 and Office 365 Exchange Admin Center do allow you to search through Advanced Search > EmailAddresses but it does not allow wild card searches and you must search each type (mailbox, group, resource, contact) separately. There may also be times where a duplicate address was assigned as direct access to Active Directory does allow for a duplicate e-mail address causing delivery failures. If you are looking from simply an Exchange perspective the Exchange commandlets will work fine. You may need to use the Active Directory commandlets which will search items not enabled within Exchange. Here are the examples along with a function example allowing you to quickly look for an e-mail address or e-mail addresses in the future.

Exchange Commandlets
Step #1: The following Exchange commandlet is the easiest method to find a specific e-mail address or portion of an e-mail address. This will find any object within Exchange that has an exact match to the e-mail address you place in the filter with -eq or email portion when using -like.

PowerShell

1

2

3

Get-Recipientemail@yourdomain.com

Get-Recipient-Filter{EmailAddresses-like"*emailportion*"}

Step #2: The following examples highlight the individual commandlets that target and return the specific Exchange object types. You can substitute -eq with -like to include wild cards.

Active Directory Commandlets
Pre-Step: Before proceeding you may need to import the Active Directory commandlets on older versions of PowerShell. Check into Step #4 for the Exchange commandlets that will also work in Office 365.

PowerShell

1

Import-ModuleActiveDirectory

Step #1A: The following example will find any active directory object that has an exact match to the e-mail address you place in the filter ie. email@yourdomain.com in this case.

Step #1B: There may be times when you want to search just a portion of the e-mail address. Perhaps you don’t know the exact spelling or domain that is used and you want to grab each one that is similar. This filter will also grab not only smtp addresses but other types such as x500: eum: sip: etc.

Step #1C: The third option is to use a LDAP query to find the matching object. The following LDAP query uses a | as an OR statement to look for the address in both the mail and proxyAddresses attributes.

Step #2: The next step I will show you is how to search the different type of email addresses that may exist. These types may be x500: eum: sip: etc. All you need to do is place the prefix and email portion in the proxyAddresses filter. This example looks for a sip address of email@yourdomain.com.

Step #3: Here we create a function that accepts input to find an e-mail address of any type. I utilize the -like and wildcards to catch all possible types. You can simply create the function in PowerShell to be able to check any address later with a lot less effort.

I have been looking for a solution to find out where in exchange/AD an email address is stored and stumbled on this. Thank you. Very useful scripts, Thank you, The email address remains to be found unfortunately. Everything is working; I just don’t like seeing his name heh.

I have some offsite journaling happening and in the Queue it shows an email address in the “From Address” of an old admin, and I continue to fail to find where he is hiding.

Any application or service can display any “From:” address even if it doesn’t exist in Exchange. If you e-mail the address and it gets bounced than you know it doesn’t exist. mail and proxyaddresses should be the only attributes you need to search.

Hi Steve, Very cool scripts! We have a number of external contacts who’ve switched their email domain. I’ve been able to ID them, with Get-Recipient -Filter {EmailAddresses -like “*emaildomain*”}, any idea on how I could then change their email domains en masse? Thanks in advance!

Steve,
What if I have two domains (trust) and some users are in both and what I want to do is target users to add them to a group but if they have accounts in both domains I only want to add the account that has a SIP or SMTP address under “Proxy Addresses” in AD?
Thanks!

I have enabled AD Features installation under Server manager on my Server but my Exchange Server is less than 2010. These command are not working on my power shell with error that Get-recipient is not a recognizable cmdlet

You need to install the Exchange Administration Tools from the Exchange install media. 2010 will also include the EMC but 2013+ will only include the PowerShell commandlets. The other option is to import the commandlets by connecting remotely to your Exchange server.