Company News

Get All Office 365 Email Addresses

February 24, 2016

Why would this be helpful?

If you have a tenancy where mail has always existed in Office365 and they now want to implement Directory Synchronization you will need to extract all user email addresses (proxy addresses) in order to import them into on-premises AD.

Failure to update AD objects prior to Initial Sync will result in AD overwriting the user’s alias’s in Office 365.


1) Connect to Office 365 Tenancy

$Usercredential = Get-Credential someone@somewhere.com
Connect-MSOLService -Credential $Usercredential


2) Get all user email addresses

Get-Mailbox | FT -Wrap Name, DisplayName,PrimarySmtpAddress,EmailAddresses


3) Get all user email addresses to .csv

Get-Mailbox -ResultSize Unlimited | Where {$_.name -NotLike ‘*DiscoverySearchMailbox*’} | Sort Alias | Select UserPrincipalName, DisplayName,Name, Alias,RecipientTypeDetails, EmailAddresses, PrimarySmtpAddress, MicrosoftOnlineServicesID, WindowsLiveID, WindowsEmailAddress | Export-CSV  c:\O365Info\GetMailbox.csv –NoTypeInformation

Leave a Reply

Stephanie Kahlam

Stephanie Kahlam


Subscribe via Email


Powered by...

itgroove Corporate Profile
Connect With Us