How to Get Exchange Online Mailboxes

Updated

How to get a list of exchange online mailboxes

In this guide, you will learn how to get a list of exchange online mailboxes using PowerShell and the Exchange Admin Center. I’ll also show you how to export a list of mailboxes to CSV using PowerShell.

Get Mailboxes in Exchange Admin Center

Step 1. Log into Exchange online.

The URL below will take you directly to the mailboxes in the Exchange admin center.

https://admin.exchange.microsoft.com/#/mailboxes

Exchange admin center mailboxes page listing the tenant's mailboxes

Under Recipient Type, it will show you the type of mailbox it is. You can sort by User Mailbox and Shared Mailbox by clicking the arrow to the right of the Recipient type.

Mailbox list sorted by the Recipient type column

Step 2. Export list of mailboxes

To export the list in the Exchange Admin Center click on “Export mailboxes”.

Export mailboxes option in the Exchange admin center

You can add additional mailbox details by clicking “Choose columns” and adding additional attributes.

Get Mailboxes using PowerShell

First, you will need to connect to Exchange Online. You need to have the “ExchangeOnlineManagement” module installed to connect and manage Exchange Online. Once this is installed you can connect with the below command.

Connect-ExchangeOnline

For more details see the article connect to exchange online PowerShell.

In the examples below, I’ll use the Get-Mailbox cmdlet to get a list of mailboxes from Exchange Online.

Example 1: Get all mailboxes in the tenant

Get-Mailbox -ResultSize Unlimited

The above command will list all mailboxes in your tenant.

Get-Mailbox output listing every mailbox in the tenant

Example 2: List All Mailboxes and Mailbox type

 Get-Mailbox -ResultSize Unlimited | select Name, RecipientTypeDetails

This command will list all mailboxes with the mailbox name and type (user or shared).

Mailboxes listed with their name and recipient type details

Example 3: List only Shared Mailboxes

Get-Mailbox -RecipientTypeDetails SharedMailbox -ResultSize Unlimited

This command will only list the shared mailboxes.

Get-Mailbox output filtered to shared mailboxes only

Example 4: Get Full Mailbox Details

Get-Mailbox -Identity emailladdress | fl

By default, the get-mailbox command shows very few mailbox details. Use the fl option to display full details.

Full mailbox detail returned by piping Get-Mailbox to Format-List

Example 5: List Mailboxes that have archive enabled

Get-Mailbox -Archive

Example 6: List a specific mailbox and the delegates

Get-Mailbox -Identity 123User -RecipientTypeDetails SharedMailbox -ResultSize Unlimited | Get-MailboxPermission | Select-Object Identity,User,AccessRights

This command will list the mailbox, delegates (If any), and the delegate’s permissions.

Mailbox delegates listed with their access rights

Example 7: Export list of mailboxes to CSV

Get-Mailbox -ResultSize Unlimited | Export-Csv "c:\temp\allmailboxes.csv"

To export any of these examples to CSV use the pipe and then export-csv “file-path”.

The spreadsheet looks like the following:

Exported mailbox list opened as a spreadsheet

Example 8: List mailboxes by keyword or with certain characters

Get-Mailbox -Anr abc

The above command will search for the string abc. The -Anr parameter will search for the string in these attributes: CommonName, DisplayName, FirstName, LastName and Alias.

Get-Mailbox with the Anr parameter matching mailboxes by keyword

I hope you found this guide useful. If you have questions or comments please leave them below.