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.

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.

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.

1 Comment

If I could suggest an improvement, it’s to use the “-filter” capability of Get-Recipient instead of the Where clause. Filtering means the Office365 server does the searching and only sends you the accounts that match the filter, whereas the Where clause means Office365 sends you ALL of the accounts in your tenant and your local Powershell has to crawl through them looking for a match. Probably not a huge difference if you’ve only got a few dozen accounts, but if you’ve got hundreds or thousands, it makes an enormous difference.