Managing shared mailboxes in Microsoft 365 (M365) is a critical task for IT administrators, particularly after a migration. Monitoring shared mailbox sizes ensures compliance with Microsoft’s storage limits and avoids service disruptions. Shared mailboxes in Microsoft 365 come with a 50 GB storage limit if they are unlicensed. Once the limit is exceeded, the mailbox cannot send or receive emails unless a license is assigned. This guide provides step-by-step instructions to check shared mailbox sizes using PowerShell and addresses how to manage oversized mailboxes effectively.
Monitoring shared mailbox sizes in M365 helps to:
Before retrieving shared mailbox sizes, ensure you:
If the module is not already installed, run the following command in PowerShell:
Install-Module -Name ExchangeOnlineManagement
1. Open PowerShell as an administrator.
2. Connect to Exchange Online:
Connect-ExchangeOnline -UserPrincipalName <your-admin-username>
3. Authenticate using your credentials.
To list all shared mailboxes, use:
Get-Mailbox -RecipientTypeDetails SharedMailbox
This command provides an overview of shared mailboxes in your tenant.
Combine the Get-Mailbox
and Get-MailboxStatistics
cmdlets to fetch mailbox sizes:
Get-Mailbox -RecipientTypeDetails SharedMailbox | ForEach-Object { $mailbox = $_ $stats = Get-MailboxStatistics -Identity $mailbox.Identity [PSCustomObject]@{ DisplayName = $mailbox.DisplayName PrimarySMTPAddress = $mailbox.PrimarySmtpAddress TotalItemSize = $stats.TotalItemSize.Value.ToString() ItemCount = $stats.ItemCount } } | Format-Table -AutoSize
This command outputs details such as:
To locate mailboxes exceeding a specific size (e.g., 40 GB), run:
Get-Mailbox -RecipientTypeDetails SharedMailbox | ForEach-Object { $mailbox = $_ $stats = Get-MailboxStatistics -Identity $mailbox.Identity if ($stats.TotalItemSize.Value.ToGB() -gt 40) { [PSCustomObject]@{ DisplayName = $mailbox.DisplayName SizeInGB = $stats.TotalItemSize.Value.ToGB() } } } | Format-Table -AutoSize
This helps identify mailboxes approaching the 50 GB limit.
If a shared mailbox exceeds the 50 GB limit, you need to:
1. Assign a License: Use the Microsoft 365 Admin Center or PowerShell to assign a license to the mailbox.
Set-MsolUserLicense -UserPrincipalName <MailboxIdentity> -AddLicenses "<LicenseName>"
2. Convert to a Regular Mailbox (if necessary):
Set-Mailbox -Identity <MailboxIdentity> -Type Regular
Get-Mailbox
command to verify the shared mailbox exists.Monitoring shared mailbox sizes in Microsoft 365 is essential to maintain uninterrupted service and ensure compliance with storage limits. PowerShell provides an efficient and powerful way to retrieve mailbox statistics and manage oversized mailboxes. By following these steps, IT administrators can proactively address storage issues and streamline mailbox management.
For expert assistance with managing your Microsoft 365 environment, consider partnering with Medha Cloud. With extensive experience in M365 administration and cloud solutions, Medha Cloud ensures:
Contact Medha Cloud today to simplify your Microsoft 365 management and enhance productivity.
Reach us at: