Export Office 365 Mailbox Size Report Using PowerShell 

As an admin, it is an important task to periodically monitor Office 365 mailbox size and quotas. Else, it will end up in error like ‘mailbox size limit exceeded,’ ‘unable to send/receive messages due to mailbox quota,’ etc. 

So, how will you check the mailbox size in Office 365? You can use either the Exchange admin center or PowerShell to get mailbox usage report. But the Exchange admin center can show limited information only. With PowerShell, you can get detailed mailbox size report. However, you need to combine multiple cmdlets like Get-MailboxGet-MailboxStatistics, etc. 

To ease your work, we have created handy PowerShell script to export mailbox size and quotas to a nicely formatted CSV file. 

 

Download Script: GetMailboxSizeReport.ps1 

 

Script Highlights: 

  • The script uses modern authentication to connect to Exchange Online.  
  • The script can be executed with MFA enabled account too.  
  • Exports report results to CSV. 
  • You can choose to either export mailbox size of all mailboxes or pass an input file to get usage statistics of specific mailboxes alone. 
  • Allows to use filter to get user mailboxes’ size alone 
  • Allows to use filter to get shared mailboxes size alone. 
  • Automatically installs the EXO (Exchange Online) V2 module (if not installed already) upon your confirmation. 
  • The script is scheduler friendly. I.e., Credential can be passed as a parameter instead of saving inside the script. 

 

Office 365 Mailbox Size Report – Sample Output: 

The exported mailbox size usage report looks like screenshot below: 

mailbox size report office 365

The exported mailbox size and quota report contains following attributes: 

  • Display Name 
  • User Principal Name 
  • Mailbox Type 
  • Primary SMTP Address 
  • Item Count (Emails, Attachments, Calendar events, etc.) 
  • Total Item Size 
  • Is Archived
  • Deleted Item Count 
  • Total Deleted Item Size 
  • Issue Warning Quota 
  • Prohibit Send Quota 
  • Prohibit Send and Receive Quota 

 

How to Export Mailbox Size Report to CSV? 

Step 1: Download the script 

Step 2: Start Windows PowerShell as Administrator 

Step 3: Since the script supports both MFA enabled account and non-MFA account, it requires a different approach for each method. To run this script, you can choose any one of the below methods 

Method 1: Execute script with non-MFA account. 

 

Method 2: Execute script using MFA account. 

To know more about how to connect exchange online PowerShell with MFA, refer to our blog: Connect to Exchange Online PowerShell with MFA. 

 

Method 3: Execute script by explicitly mentioning credential (Scheduler friendly).  

 

More Use-cases of ‘Office 365 Mailbox Usage Statistics Report’ 

The script supports advanced filtering params which, helps you to get the report as per your need. 

Get Office 365 Shared Mailbox Size Report: 

To get a shared mailbox size report, quotas, and size warning, you can run the script with SharedMBOnly param. 

The exported shared mailbox usage size report contains mailbox storage size, quotas, and mailbox size warning. By referring to this report, admin can increase the mailbox size. 

 

Get User Mailbox Size Report: 

To check the size of user mailboxes, you can execute the script with UserMBOnly param.  

The output contains mailbox storage statistics like total item size, item count, deleted item count, mailbox size limits, quota status, etc. 

 

Get Mailbox Usage Size Report for a Single/List of Office 365 Mailboxes: 

You can use MBNamesFile param to check mailbox size from the input list called “MBNames.txt.”   

To get the storage size of specific mailboxes, pass an input file with a Display Name/ Alias/ Distinguished Name/ Canonical DN/ Email Address or GUID of Shared Mailboxes.  

The mailbox names CSV File must follow the format below: Identity of mailboxes separated by new line without a header. 

 

List all Mailboxes Sorted by Mailbox Size: 

To get the top list of big mailboxes (I.e., sorted by mailbox size), run the script, and open the report with Excel. And then, sort the ‘Total Size (Bytes)’ column. Now, you can see the mailbox size report that is sorted by mailbox storage size. 

 

Office 365 Mailbox Quota Report: 

By default, the script exports mailbox quota information. Quota information includes issue warning quota, prohibit send quota, and prohibit send & receive quota. By referring to this data, you can increase the mailbox size and the quota. 

 

Automate Exchange Mailbox Used Size Report: 

Since this script is scheduler-friendly, you can schedule script in Windows Task Scheduler by explicitly mentioning the credential. 

 

I hope this blog is useful to check the mailbox size and quota report. If you have any queries, reach us through the comment section.