• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Tachytelic.net

  • Sco Openserver
    • Sco Unix Support
    • SCO Openserver Installation ISOs
    • SCO Openserver Binaries
    • Add a Hard Drive to an Openserver 5 Virtual Machine
    • Install SCO Vision SQL-Retriever ODBC Driver on Windows 10
    • License Expired on Virtual SCO Openserver Installation
    • How to reset the root password on SCO Openserver 5
  • Scripting
    • PowerShell
      • Add leading zeros
      • Check if a File Exists
      • Grep with Powershell
      • Create Environment Variables
      • Test for open Ports
      • Append to a Text File
    • VBScript
      • Check if a File Exists
      • lpad and rpad functions
      • Windows Update E-Mail Notification
  • Office 365
    • Connect to Office 365 with PowerShell
    • Add or remove an email alias using Powershell
    • Change Primary email address of Active Directory user
    • How to hide an AD user from the Global Address List
    • How to hide mail contacts from the Global Address List
    • Change the primary email address for an account with PowerShell
    • Change Primary email address of an AD User
    • Grant a single user access to access to all calendars
    • Forward email to an external address using Powershell
    • Convert shared mailbox to user mailbox with Powershell
  • Get in Touch
  • About Me
    • Privacy Policy

Office 365 – Find user by email address or alias

September 16, 2019 by Paulie Leave a Comment

You can search for an Office 365 user by their primary email address or other aliases using Powershell.

First, connect to Office 365 with PowerShell

Once you are connected you can search for a specific address or export all addresses to a CSV file for analysis in another tool.

Find Office 365 User by Email Address

Example PowerShell code to find user by email address:

Get-Mailbox -Identity * |
Where-Object {$_.EmailAddresses -like 'SMTP:[email protected]'} |
Format-List Identity, EmailAddresses

The above command will only find this specific email address and that will have to be the primary email address of the mailbox as denoted by the uppercase “SMTP”.

You can also do wildcard searches easily:

Get-Mailbox -Identity * |
Where-Object {$_.EmailAddresses -like '*paul*@tachytelic.net'} |
Format-List Identity, EmailAddresses

By default Get-Mailbox will only return results from active mailboxes. So you may need to specify the ” -IncludeInactiveMailbox” parameter.

Below is a form you can use to help you put together the command you need.

Export all email addresses to a CSV File

If you prefer, you can simply output the email address of every user to a CSV file and analyse the addresses and aliases in another tool:

get-mailbox -identity *|
select-object Identity, EmailAddresses|
export-csv EmailAddresses.txt -NoTypeInformation

Filed Under: Office 365 Tagged With: Office 365, Powershell

Reader Interactions

Leave a Reply Cancel reply

Primary Sidebar

Link to my LinkedIn Profile

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 107 other subscribers.

Go to mobile version