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.
Topics in this guide:
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
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.
Step 2. Export list of mailboxes
To export the list in the Exchange Admin Center click on “Export mailboxes”.
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.
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).
Example 3: List only Shared Mailboxes
Get-Mailbox -RecipientTypeDetails SharedMailbox -ResultSize Unlimited
This command will only list the shared mailboxes.
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.
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.
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:
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.
I hope you found this guide useful. If you have questions or comments please leave them below.
How to get shared mailbox owner details using Powershell command.