skip to Main Content

List mailboxes in Exchange database with PowerShell

An excellent way to find out which mailboxes are on an Exchange database is to use PowerShell. With Exchange Management Shell, you can immediately see which mailboxes are located in the database. In this article, you will learn how to list mailboxes in a database.

Get mailbox database name

Before you start, you want to have the mailbox database name. Run Exchange Management Shell as administrator.

Get all mailbox databases with Get-MailboxDatabase cmdlet. Use the -Status switch to check the mailbox database mount status. Use the -IncludePreExchange switch to get mailbox databases in older Exchange servers.

Mount the mailbox database, otherwise you can’t list the mailboxes.

[PS] C:\>Get-MailboxDatabase -Status -IncludePreExchange | Sort Name | Format-Table Name, Server, Mounted

Name Server    Mounted
---- ------    -------
DB01 EX01-2016    True
DB02 EX02-2016    True
DB03 EX01-2016    True
DB04 EX02-2016    True

Read more: Get Exchange mailbox database mount status with PowerShell »

In the next step, we will list all mailboxes in the Exchange database.

List all mailboxes in a database

Find out what mailboxes are in a mailbox database. In this example, we will check mailbox database DB02.

[PS] C:\>Get-Mailbox -Database "DB02" | ft Name, Alias, WindowsEmailAddress, UserPrincipalName

Name            Alias           WindowsEmailAddress       UserPrincipalName
----            -----           -------------------       -----------------
Piers Bower     Piers.Bower
Richard Grant   Richard.Grant
Nicholas Murray Nicholas.Murray
Ruth Dickens    Ruth.Dickens
Jonathan Fisher Jonathan.Fisher
Grace Rees      Grace.Rees
Patrick Mors    Patrick.Mors

Export all mailboxes in a database to CSV file

Export to CSV file in the directory C:\temp. Create a temp folder if you don’t have one.

[PS] C:\>Get-Mailbox -Database "DB02" | select Name, Alias, WindowsEmailAddress, UserPrincipalName | Export-Csv C:\temp\MailboxesDB02.csv -NoTypeInformation -Encoding UTF8

Open the CSV file with Microsoft Excel or another favorite application of your choice.

Keep reading: Determine if a mailbox is on-premises or in Office 365 »


In this article, you learned how to list mailboxes in Exchange database with PowerShell. It’s good to know which mailboxes are in a database before you migrate or when there are problems on a database, and you want to see if a mailbox is located on that database. The PowerShell cmdlets are excellent to use.

Did you enjoy this article? You may like Add database copy Exchange Server. Don’t forget to follow us and share this article.



ALI TAJRAN is a passionate IT Architect, IT Consultant, and Microsoft Certified Trainer. He started Information Technology at a very young age, and his goal is to teach and inspire others. Read more »

This Post Has 3 Comments

  1. Is it possible to list all mailboxes in Exchange 2013 of Mailbox type – User
    We are running Hybrid and wanted to see if I can have a list filtered out based on mailbox type

    1. You can run the below command to list user mailboxes on Exchange Server 2013:

      Get-Mailbox -Resultsize Unlimited -RecipientTypeDetails UserMailbox | Where {$_.AdminDisplayVersion -like "*15.0*"} | ft Name, Alias, WindowsEmailAddress, UserPrincipalName

      Exchange Server 2019 = 15.2
      Exchange Server 2016 = 15.1
      Exchange Server 2013 = 15.0

Leave a Reply

Your email address will not be published. Required fields are marked *