In this article, we’ll show several practical examples of using Get-Mailbox to get information about Exchange mailboxes.
Introduction to Get-Mailbox
One of the most used PowerShell commands used by Exchange administrators is the Get-Mailbox cmdlet. This cmdlet has been available since Exchange Server 2007 through Exchange Server Subscription Edition (SE), as well as Exchange Online.
The Get-Mailbox cmdlet’s purpose is simple — retrieve information about mailboxes in your Exchange organization.
Get Information on a Specific Mailbox
Exchange administrators often view the information of one mailbox at a time using the Exchange Admin Center.


You can get the information using the Get-Mailbox cmdlet by specifying the mailbox identity:
Get-Mailbox -Identity <mailbox identity>
Syntax and Common Parameters
The -Identity parameter accepts the following mailbox identifiers:
- Name
- Alias
- Distinguished name (DN)
- Canonical DN
- Email address
- GUID
- LegacyExchangeDN
- SamAccountName
- User ID or user principal name (UPN)

As you can see below, the default property set the Get-Mailbox cmdlet returns include the Name, Alias, ServerName, and ProhibitSendQuota.
Exchange Online returns a slightly different default property set that may include properties such as Name, Alias, ProhibitSendQuota, and ExternalDirectoryObjectId.

But you can find all Get-Mailbox properties by piping the resultant mailbox object to the Get-Member cmdlet:
Get-Mailbox -Identity <mailbox identity> |
Get-Member -MemberType Properties
Get All Mailboxes in Exchange
By default, Get-Mailbox returns a limited number of results (on Exchange Online, the default limit is typically 1000 objects unless you specify -ResultSize Unlimited):
Get-Mailbox
Using -ResultSize Parameter
But this limit can be adjusted by adding the -ResultSize parameter. This parameter accepts a number to indicate how many mailboxes to return. For example, the command below returns a maximum of 5000 mailboxes.
Get-Mailbox -ResultSize 5000
Return All Mailboxes with Unlimited Option
The -ResultSize parameter also accepts the word Unlimited, which indicates to return all mailboxes:
Get-Mailbox -ResultSize Unlimited

Get Mailbox in a Specific Database
Another typical Get-Mailbox usage is finding which mailboxes are in a specific database. Note that this usage applies only to Exchange Servers and not to Exchange Online.
Example: Find Mailboxes in a Specific Database
For example, the command below gets the mailboxes in the DB02 mailbox database:
Get-Mailbox -Database DB02 | Format-Table DisplayName,ServerName,Database

Filter Mailboxes by Type and Attributes
Using RecipientTypeDetails
When running the Get-Mailbox cmdlet, you can also get specific mailbox types using the RecipientTypeDetails parameter. This parameter accepts one or more mailbox types from this list:
- DiscoveryMailbox
- EquipmentMailbox
- GroupMailbox (Exchange 2013 or later and Exchange Online)
- LegacyMailbox
- LinkedMailbox
- LinkedRoomMailbox (Exchange 2013 or later and Exchange Online)
- RoomMailbox
- SchedulingMailbox (Exchange 2016 or later and Exchange Online)
- SharedMailbox
- TeamMailbox (Exchange 2013 or later and Exchange Online)
- UserMailbox
The example command below lists the SharedMailbox and RoomMailbox mailbox types.
Get-Mailbox -RecipientTypeDetails SharedMailbox,RoomMailbox | Format-Table DisplayName,RecipientTypeDetails

Get Mailbox Filtered by Attributes
The Get-Mailbox cmdlet has a -Filter parameter that lets you filter the mailbox objects to return by their attributes. You can filter mailboxes based on properties like Alias, PrimarySMTPAddress, City, Company, etc.
For example, the below command filters mailboxes whose Alias property value starts with Jo.
Get-Mailbox -Filter "Alias -like 'Jo*'"

Note that not all properties support wildcard (*) character comparison. But if they do, the wildcard character comparison is supported as a suffix (word*) and not a prefix (*word). Even if a prefix wildcard worked in some instances, Microsoft does not recommend it due to low-performance issues.
Filter Mailboxes on Litigation Hold
Another example is listing mailboxes on litigation hold. This example filters mailboxes whose LitigationHoldEnabled property is set to True. Below are two variations of this filtering example that perform the same comparison operation:
# Recommended
Get-Mailbox -Filter 'LitigationHoldEnabled -eq $true' |
Format-Table DisplayName, LitigationHoldEnabled
# Alternative with curly braces syntax
Get-Mailbox -Filter { LitigationHoldEnabled -eq $true } |
Format-Table DisplayName, LitigationHoldEnabled

Get Mailbox Sorted by Size
The mailbox size property is not included in the mailbox object returned by Get-Mailbox. You can get the TotalItemSize using the Get-MailboxStatistics cmdlet instead.
Combine Get-Mailbox with Get-MailboxStatistics
Typically, you can pipe the Get-Mailbox results to Get-MailboxStatistics like so:
Get-Mailbox | Get-MailboxStatistics
Note. In large environments, retrieving mailbox statistics for every mailbox can take a lot of time and may be subject to Exchange Online throttling. You should consider filtering mailboxes/limiting the scope of the query whenever possible.
Sort by TotalItemSize
I’ll use the primary SMTP address as the unique mailbox identifier in this example. The result is shown in descending order by TotalMailboxSize.
Get-Mailbox -RecipientTypeDetails UserMailbox | ForEach-Object { Get-MailboxStatistics $_.PrimarySmtpAddress.ToString() } | Sort-Object TotalItemSize -Descending | Select-Object DisplayName, TotalItemSize 
Get Mailbox Last Logged On Information
Finding out which mailboxes have been inactive is one way to help with housekeeping. Building upon the previous example, we can pipe the Get-Mailbox results to Get-MailboxStatistics to determine when the mailboxes were accessed and calculate how many days since:
Note that you should treat LastLogonTime as an activity indicator rather than a guaranteed user sign-in timestamp.
Get-Mailbox -RecipientTypeDetails UserMailbox |
ForEach-Object { Get-MailboxStatistics $_.PrimarySmtpAddress.ToString() } |
Sort-Object LastLogonTime -Descending |
Select-Object DisplayName, LastLogonTime, @{
n="DaysSinceLastLogOn";e={(New-TimeSpan -Start $_.LastLogonTime -End (Get-Date)).Days}
} The output is sorted by LastLogonTime, starting from the most recent.

Get Mailbox with Full Access Permissions
If you’re wondering which of your users has full access to other mailboxes, you can pipe the Get-Mailbox results to the Get-MailboxPermission cmdlet:
$fullAccessPermission = Get-Mailbox -ResultSize Unlimited |
ForEach-Object { Get-MailboxPermission -Identity $_.PrimarySmtpAddress.ToString() } |
Where-Object {
$_.AccessRights -contains "FullAccess" -and
-not $_.IsInherited
}
$fullAccessPermission | Format-Table Identity, User

How to Export Mailbox Data to CSV
After running the Get-Mailbox queries, you can export the results to a CSV file:
# Export all mailboxes to CSV
Get-Mailbox -ResultSize Unlimited |
Select-Object DisplayName, PrimarySmtpAddress, RecipientTypeDetails |
Export-Csv "C:\mailboxes.csv" -NoTypeInformation
Note. The -NoTypeInformation parameter removes the type header from the CSV output. This makes the file cleaner for use in Excel and other programs.
PowerShell Script to Get Mailbox Storage Quota Status
In pre-Exchange Server 2013, the Information Store caches the StorageLimitStatus property that determines whether the mailbox storage usage (quota) status is normal, warning, sending disabled, and send/receive disabled.
There’s no straightforward method to get the mailbox storage quota status beginning in Exchange 2013 and Exchange Online. Lucky for you, we’ve created a PowerShell function that you can conveniently use to report the mailbox quota status.
You can get the script from this repository →: GetMailboxQuotaStatus. Import the function into your PowerShell session by dot-sourcing or pasting the code directly.

The script mentioned above provides a Get-QuotaStatus function. It compares mailbox size against configured quotas and returns one of the following statuses:
- BelowLimit — mailbox is within quota limits
- IssueWarning — mailbox has reached the warning quota
- ProhibitSend — mailbox can receive but not send emails
- ProhibitSendReceive — mailbox cannot send or receive emails
Get the Quota Status of All Mailboxes
To get the quota status of all mailboxes, run this command.
Get-Mailbox -ResultSize Unlimited | Get-QuotaStatus

Get the Quota Status of One or More Mailboxes
This example gets the mailbox quota status of one mailbox.
# Using the pipeline input Get-Mailbox <identity> | Get-QuotaStatus # Using the parameter input Get-QuotaStatus -Mailbox (Get-Mailbox <identity>) Get-QuotaStatus -Mailbox <email@domain.com>,<Alias>,<SamAccountName>

Wrapping Up
The Get-Mailbox cmdlet is an indispensable tool in an Exchange Administrator toolbox. It may be a simple command, but it can be used to get basic and complex information about Exchange Server or Exchange Online mailboxes.
What is the Get-Mailbox cmdlet used for?
The Get-Mailbox cmdlet retrieves information about mailboxes in Exchange Server (2007–2019) and Exchange Online. It can return details about individual mailboxes or multiple mailboxes based on filters and parameters.
How do I get information about a specific mailbox?
Use the -Identity parameter:
Get-Mailbox -Identity <mailbox identity>
You can specify the mailbox by Name, Alias, Email address, UPN, GUID, Distinguished Name, and other identifiers.
Can I filter mailboxes by attributes like city or alias?
Yes. The -Filter parameter lets you filter results by properties such as Alias, PrimarySMTPAddress, City, Company, and more. Example:
Get-Mailbox -Filter "Alias -like 'Jo*'"
How can I find mailboxes in a specific database?
Use the -Database parameter (Exchange Server only):
Get-Mailbox -Database DB02
How do I check mailbox sizes?
The mailbox size is not included in Get-Mailbox output. Instead, pipe results to Get-MailboxStatistics:
Get-Mailbox | Get-MailboxStatistics | Sort-Object TotalItemSize -Descending
How do I check mailbox quota status in Exchange?
In Exchange 2013 and newer, use the custom Get-QuotaStatus function. For all mailboxes:
Get-Mailbox -ResultSize Unlimited | Get-QuotaStatus
