See which shared mailboxes are above 50Gb in Exchange Online

Shared mailboxes receive a maximum of 50Gb when no license is assigned

Microsoft has always said that a shared mailbox can be up to 50Gb unless you have assigned a license.
This is not the case in most tenants and this has always been tolerated by Microsoft.
Now they are really going to force this by capping shared mailboxes at 50Gb that do not have a license.

Here is the link for Exchange Online limits, including Shared mailbox capacities.

A PowerShell script to check if you have Shared Mailboxes above 50Gb

So, to make sure that your shared mailboxes in Exchange Online do not reach their limit, I have created a script that can check if you are close to the limit. the default is a 50Gb limit, but you can change this with a Parameter.

Exchange Online PowerShell module

I assume in the script that you are an administrator in Exchange Online, and that you already have the Exchange Online module installed.
The PowerShell module for EXO can be found here.

Using PowerShell for Exchange Online

The script needed to log in to Exchange Online.
Copy / paste it into PowerShell.


The Script

You can download the script from Github.
Click here for the downloadable link.

There are 2 optionable Parameters

  • RecipientTypeDetails
    The default is SharedMailbox. You can also use the script for other RecipientTypes.
  • MaximumLimit
    The default is 50Gb. You can set the MaximumLimit with Gb only. The script will convert this to bytes.
    You can set this to a lower amount to see which mailboxes are close to 50Gb.

When the property OverLimit equals True, the mailbox reached the limit.



Get-MailboxLimits -RecipientTypeDetails 'UserMailbox'

Get-MailboxLimits -MaximumLimit 48

Get-MailboxLimits -RecipientTypeDetails 'UserMailbox' -MaximumLimit 45


If you have any questions about this script, you can leave a comment.

Published by

Bas Wijdenes

My name is Bas Wijdenes and I work as a PowerShell Automation Engineer. My main focus is PowerShell, Azure AD, Azure Infrastructure, Server Management, and Exchange (Online).

One thought on “See which shared mailboxes are above 50Gb in Exchange Online”

  1. PS C:\WINDOWS\system32> foreach ($mb in $mbxs)
    >> Repost error – And export in blank excel.csv

    No linha:1 caractere:23
    + foreach ($mb in $mbxs)
    + ~
    Corpo de instrução ausente no loop foreach .
    + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : MissingForeachStatement

Leave a Reply

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