Searching “hidden” Email addresses Using PowerShell | Office 365 | Part 11#13 5/5 (3) 6 min read

In the current article, we review the process in which we use PowerShell for creating a search in Office 365 and Exchange Online environment, looking for a “hidden” or “ghost” E-mail address.


The term ““ghost E-mail address” is not a technical term but instead, a term that I use for describing a scenario in which we need to locate a specific E-mail that we cannot find by using the standard Exchange Online web management interface.

An example to such as case could be a scenario in which we want to add an E-mail address to Exchange Online recipient, and we get an error message that informs us that the E-mail address is associated with another recipient.

The challenge that we face is – how to locate the “hidden recipient” that own this E-mail address.

Looking for Exchange Online with a specific Alias or E-mail address

Using a PowerShell script for implementing a “unified search” of E-mail address | Exchange Online + Office 365 infrastructure

The PowerShell query that we use for locating the E-mail address is based on the PowerShell “Where statement”.

The PowerShell Where statement, define a “search condition” that address Exchange Online recipient and Office 365 users.

  • Regarding Exchange Online recipient, we will query the property – EmailAddresse
  • Regarding Office 365 user account, we will query the property ProxyAddresses and
    the property – UserPrincipalName
In the article – Searching Email addresses with a specific domain name suffix Using PowerShell | Office 365 | Part 10#13, include more detailed information about the search scope in Office 365 and the PowerShell cmdlets that we use

Regarding the subject of PowerShell command that uses the “Where statement” and the structure of the command, you can read the article – Searching for an Email addresses using PowerShell | Where Filter | Office 365 | Part 9#13

The following PowerShell command performs a search for a specific E-mail address by “addressing” all the Exchange Online recipients (the PowerShell command Get-Recipient).

The Where statement address the “EmailAddresses property” of the Exchange Online recipient, and look for a text string “*[email protected]”.

Notice that we use the PowerShell operator “Like” that doesn’t perform an “exact match”.
Although that technically we can use the PowerShell operator “eq” (equal), I prefer to use the PowerShell operator “Like” because in Office 365 based environment, the “E-mail address” that we look for can “reveal” as:

  • SMTP E-mail address
  • SIP E-mail address
  • Office 365 UPN name

If we will use the PowerShell operator “eq” (equal), we will need to provide the “exact string” that we look for.
For example, if we want to look for “bob E-mail address” we will need to use a syntax such as:
Where {$_.EmailAddresses -eq “smtp:[email protected]”}

Using a PowerShell script for performing a “unified search”, looking for a specific E-mail address or specific UPN name.

To purpose of the following PowerShell script is, helping us to perform a “unified” search, that will query – Azure Active Directory infrastructure, and Exchange Online infrastructure.

  • The script “address” all the available Exchange Online recipients and Office 365 users, and query the specific properties that include information about E-mail address or UPN name.
  • The PowerShell script uses the “Where statement”, that define the search query condition – looking for a
    specific E-mail address. (when executing the script, you will need to type the “E-mail address” that you look for).
  • In case that PowerShell find Office 365 user or Exchange Online recipient that uses the specific E-mail address, the information will be displayed on the screen.

Using a Menu based PowerShell script.

If you are “afraid” from the complex syntax, I have prepared easy to use Menu based Menu based PowerShell script.

The PowerShell script will help you to create the required remote PowerShell connection to Azure Active Directory + Exchange Online, and execute the required search by selecting the specific menu number.

In the article – How to use the PowerShell script – manage Email addresses in Office 365 | Part 13#13, you can find more detailed information about how to use the Menu based PowerShell script.

Creating remote PowerShell session.

You will need to create a remote PowerShell session with Azure Active Directory (Office 365) + Exchange Online.

In case that you are not familiar with this process you can read the articles:

Searching for specific E-mail address | search scope = Exchange Online

This following PowerShell script example, perform a search that addresses only Exchange Online infrastructure

The search addresses all existing Exchange Online recipients and searches for a
specific E-mail address E-mail address.


Managing E-mail Addresses | PowerShell scripts series

The subject of “Managing E-mail addresses” in an Exchange environment, can be translated into various administrative tasks such as – Bulk Adding Alias E-mail address to multiple Exchange Online mailboxes, Bulk Removing Alias E-mail address from multiple Exchange Online mailboxes, backup existing E-mail address, replace primary E-mail address and so on.
To be able to accomplish these various tasks, I have created seven PowerShell menu scripts, that will help you in performing these tasks.

Export Email addresses | Exchange Online | Using PowerShell | 1#7

A PowerShell menu script, that will help you to:
Create a report (that will be exported to files) about – All Exchange Online recipients and their different type of E-mail address such as SMTP E-mail address (Primer E-mail address and Alias E-mail address), SIP address, X.500 E-mail address, etc.

You can read more detailed information about the PowerShell commands that are used in the script in the articles:

Export and display information about Email addresses using PowerShell - Office 365 - Part 6-13


Search Email Addresses + export | Exchange Online | Using PowerShell | 2#7

A PowerShell menu script that will help you to:
Perform a search for a specific E-mail address or, for an E-mail address that uses a specific Domain name suffix of Exchange Online recipients, and exports the information to files.

In case that you want to get more detailed information about the subject of – locating specific E-mail addresses, you can read the articles:

Searching hidden Email addresses Using PowerShell - Office 365 - Part 11-13


Bulk Add Alias E-mail address – Specific Domain name suffix | 3#7

A PowerShell menu script that will help you to:
TEST + implement the process of – Bulk add additional Alias E-mail addresses with a specific Domain name suffix, to multiple Exchange Online mailboxes.

Additional information

In case that you want to get more detailed information about the subject of – adding additional Alias E-mail address, you can read the articles:

Adding Email addresses using PowerShell - Bulk mode - Office 365 - Part 4-13


Add Additional Proxy (Alias) E-mail address | import from a CSV | 4#7

A PowerShell menu script that will help you to:
TEST + implement the process of – Bulk add an additional Proxy (Alias) E-mail addresses to the Exchange Online recipient, that are imported from a CSV file.

Additional information

In case that you want to get more detailed information about the subject of – Add additional Alias E-mail by importing the information from a CSV file, you can read the articles:

Adding Email addresses using PowerShell - Office 365 - Part 3-13


Bulk Remove Alias E-mail address – Specific Domain name suffix | 5#7

A PowerShell menu script that will help you to:
TEST + implement the process of – Bulk deleting existing Alias E-mail addresses with a specific Domain name suffix from multiple Exchange Online mailboxes.

Additional information

In case that you want to get more detailed information about the subject of – removing (deleting) E-mail address with a specific domain name suffix, you can read the article   Remove Email addresses using PowerShell | Office 365 | Part 12#130
Remove Email addresses using PowerShell - Office 365 - Part 12-13


Assign NEW Primary E-mail address using a specific Domain name suffix | 6#7

A PowerShell menu script that will help you to:
TEST + implement the process of – Bulk replacing (remove) existing primary E-mail addresses, with a NEW Primary E-mail address that has a specific Domain name suffix.

Additional information

In case that you want to get more detailed information about the subject of – replacing Primary E-mail address, you can read the article – Adding Email addresses using PowerShell | Office 365 | Part 3#13

Adding Email addresses using PowerShell - Bulk mode - Office 365 - Part 4-13


Manage E-mail addresses – Single mailbox | Exchange Online | 7#7

A PowerShell menu script that will help you to:
Manage E-mail address of a specific Exchange Online mailbox (add Alias, delete Alias, replace primary E-mail address).
Adding Email addresses using PowerShell - Office 365 - Part 3-13

The next article in the current article series

Remove Email addresses using PowerShell | Office 365 | Part 12#13

Now it’s Your Turn!
It is important for us to know your opinion on this article

Restore Exchange Online mailbox | Article series index

Summary
Searching “hidden” Email addresses Using PowerShell | Office 365 | Part 11#13
Article Name
Searching “hidden” Email addresses Using PowerShell | Office 365 | Part 11#13
Description
In the current article, we review the process in which we use PowerShell for creating a search in Office 365 and Exchange Online environment, looking for a “hidden” or “ghost” E-mail address.
Author
Publisher Name
o365info.com
Publisher Logo

Related Post

Please rate this

Eyal Doron on EmailEyal Doron on FacebookEyal Doron on GoogleEyal Doron on LinkedinEyal Doron on PinterestEyal Doron on RssEyal Doron on TwitterEyal Doron on WordpressEyal Doron on Youtube
Eyal Doron
Share your knowledge.
It’s a way to achieve immortality.
Dalai Lama

Leave a Reply

Your email address will not be published. Required fields are marked *