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

Active Directory, Exchange, Lync / Skype for Business, Office 365

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.

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.

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 #1D: The following LDAP query adds a wild card to the search which also allows you to find a portion of the e-mail address if you do not know the specifics.

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.

As with all of my posts, I look forward to any questions or scenarios that you have in your environment. If you have any questions please post below.

Print Friendly, PDF & Email

10 comments

Leave a Reply to Lee Davila Cancel reply