An on-prem Exchange or cloud Exchange Online (Microsoft 365) administrator must control user mailbox sizes. In this article, we’ll show how to get current mailbox sizes and set mailbox quotas for Exchange users. The article is divided into two parts: the first one tells how to configure mailbox size limits in an on-premises Exchange Server 2019/2016/2013, and the second one deals with mailbox size quotas in Microsoft 365 (Exchange Online).
How to Get Mailbox Size in Exchange 2019/2016/2013?
You can view the current size of a user mailbox in the Exchange Admin Center GUI (AEC). Find a user in the Recipients section, open its properties and go to the Mailbox Usage section. The screenshot shows that the current mailbox size is 26 MB (0% used of 100GB available)
.
However, it is easier for me to use PowerShell to get the size of user mailboxes in Exchange Server. Open EMS (Exchange Management Shell) or connect to your Exchange server remotely.
To get basic user mailbox statistics from an Exchange server, the Get-MailboxStatistics cmdlet is used. A user name is specified as an argument. When run without parameters, a user name (DisplayName
), a number of items in the mailbox (ItemCount
), a mailbox size limit (StorageLimitStatus
), and the last time the mailbox was accessed (LastLogonTime
) are displayed.
Get-MailboxStatistics f.swaelen
To get the total size of a mailbox (the size of all items in it) and the size of removed items, run the command below:
Get-MailboxStatistics f.swaelen |ft DisplayName, TotalItemSize, ItemCount, totaldeleteditemsize, storagelimitstatus
You can get a list of all mailboxes in a specific mailbox database:
Get-Mailbox -Database Mun-MBX1| Get-MailboxStatistics | ft displayname,totaldeleteditemsize,totalitemsize
ResultSize:Unlimited
option.You can sort the table by the size of the user mailbox and display, for example, the top 10 largest mailboxes:
Get-Mailbox -Database MUN-MBX1| Get-MailboxStatistics | sort-object totalitemsize –descending | Select-Object displayname, totalitemsize -First 10
If you want to export the command output to a CSV file, add | Export-CSV top10mailbox.csv
to the command.
Managing Mailbox Quotas in Exchange Server
To limit the size of Exchange Server mailboxes, quotas are used. You can configure a quota on the mailbox database or specific user mailbox level.
You can list the current Exchange mailbox database quotas as follows:
Get-MailboxDatabase -Identity MUN-MBX2| fl *quota
Quotas are set using three options:
- IssueWarningQuota — a mailbox size when a user starts to get notifications about reaching the mailbox limit
- ProhibitSendQuota — a mailbox size when sending emails is prohibited
- ProhibitSendReceiveQuota — a mailbox size when both sending and receiving emails are blocked
To change the quota size for an Exchange database, the following command is used:
Set-MailboxDatabase -Identity MUN-MBX2 -IssueWarningQuota 19GB -ProhibitSendQuota 19.5GB -ProhibitSendReceiveQuota 20GB
You can also set database quotas from the Exchange Admin Center (EAC) graphical interface. Open Servers -> Databases -> select a database -> go to the Limits tab.
Exchange database quotas are applied to all mailboxes in the database. However, you can override quotas for specific user mailboxes. To apply personal quotas to a mailbox, you need to disable database quota inheritance (UseDatabaseQuotaDefaults = false
) and set new limits:
Set-Mailbox -Identity f.swaelen -IssueWarningQuota 30GB -ProhibitSendQuota 40GB -ProhibitSendReceiveQuota 50GB -UseDatabaseQuotaDefaults $false
You can display personal mailbox quota settings:
Get-Mailbox -Identity f.swaelen | fl UseDatabaseQuotaDefaults,IssueWarningQuota,ProhibitSendQuota,ProhibitSendReceiveQuota
Or you can configure individual mailbox quotas through the EAC. Go to the Mailbox Usage tab in mailbox properties. Check Customize the settings for this mailbox and set new mailbox limits.
New quotas are not applied to a user mailbox immediately. You have to wait 2-3 hours or use the Update-StoreMailboxState username
cmdlet to force synchronize the mailbox settings with the Active Directory user account.
The command below returns a list of mailboxes, which sizes reach or exceed the quota:
Get-MailboxStatistics -Server MUN-MBX2| where{($_.StorageLimitStatus -contains“IssueWarning”) -or ($_.StorageLimitStatus -contains “ProhibitSend”)}
How to Check Mailbox Size and Quotas in Exchange Online (Microsoft 365)?
In Exchange Online (Microsoft 365), a mailbox size limit depends on the assigned plan and the mailbox type. Most Microsoft 365 mailboxes are limited to 50 GB. If you have assigned Microsoft E3 or E5 licenses to your users, the mailbox limit is increased to 100GB, but it is only 2GB for the F3 license.
Also, depending on the assigned plan a user may use an archive mailbox (In-Place Archive) with the limit of 50 GB. When using Exchange Online Plan 2 or Exchange Online Plan 1 (with Exchange Online Archiving add-on), the size of an archive mailbox may reach 1.5 TB if it grows up to 1 GB per day.
You can get the current size of an Exchange Online user mailbox in the Exchange Admin Center.
You can also get information about the mailbox size and quota in PowerShell. Connect to your Exchange Online tenant using the cmdlet below:
Connect-ExchangeOnline
To display information about a size of a user mailbox and the number of items in it:
Get-ExoMailboxStatistics maxbak|select ItemCount,TotalItemSize
Or information about all mailboxes in the tenant sorted by their size:
Get-ExoMailbox| Get-ExoMailboxStatistics |select DisplayName,ItemCount,TotalItemSize|Sort-Object -Property TotalItemSize –Descending
Find all mailboxes larger than 50GB:
Get-EXOMailbox | Get-EXOMailboxStatistics | Where-Object {[int64]($PSItem.TotalItemSize.Value -replace '.+\(|bytes\)') -gt "50GB"} | Sort-Object TotalItemSize -Descending | Select-Object DisplayName, ItemCount, TotalItemSize
The total size of all user mailboxes in your Microsoft 365 tenant:
((Get-EXOMailbox -ResultSize Unlimited | Get-EXOMailboxStatistics).TotalItemSize.Value.ToMB() | measure-object -sum).sum
You can list mailbox quota settings according to the assigned plan as shown below:
Get-EXOMailbox maxbak -PropertySets Quota
ProhibitSendQuota : 99 GB (106,300,440,576 bytes) ProhibitSendReceiveQuota : 100 GB (107,374,182,400 bytes) RecoverableItemsQuota : 30 GB (32,212,254,720 bytes) RecoverableItemsWarningQuota : 20 GB (21,474,836,480 bytes) CalendarLoggingQuota : 6 GB (6,442,450,944 bytes) UseDatabaseQuotaDefaults : False IssueWarningQuota : 98 GB (105,226,698,752 bytes) RulesQuota : 256 KB (262,144 bytes) ArchiveQuota : 110 GB (118,111,600,640 bytes) ArchiveWarningQuota : 100 GB (107,374,182,400 bytes)
You can enable an archive mailbox for a user:
Enable-Mailbox -Identity maxbak -Archive
To make an archive automatically expand:
Enable-Mailbox -Identity maxbak -AutoExpandingArchive
You can display a list of mailboxes with the enabled archive and the size of archive mailboxes:
Get-ExoMailbox -Archive | Get-ExoMailboxStatistics |select DisplayName,ItemCount,TotalItemSize