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 a mailbox usage report. But the Exchange admin center can show limited information only. With PowerShell, you can get a detailed mailbox size report. However, you need to combine multiple cmdlets like Get-Mailbox, Get-MailboxStatistics, etc.
To ease your work, we have created a handy PowerShell script to export mailbox size and quotas to a nicely formatted CSV file.
Download Script: GetMailboxSizeReport.ps1
- 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:
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
Note: You can refer to the Archive mailbox size report to know more about mailboxes’ archive-related information like archive status, size, archive quota, etc.
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).
./GetMailboxSizeReport.ps1 -UserName Admin@contoso.com -Password XXXX
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.
./GetMailboxSizeReport.ps1 -MBNamesFile C:/MBNames.txt
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 a script in Windows Task Scheduler by explicitly mentioning the credential.
<Script location>\GetMailboxSizeReport.ps1 -UserName <AdminName> -Password <Password>
Get More Detailed Mailbox Usage Reports:
If you want to get detailed mailbox usage report based on
- Mailbox size
- Mailbox size and the storage-used percentage
- Mailbox size over time
- Mailbox over warning quota
- Mailbox quota statistics
- Email activity
- Daily mail read/sent/received count by users
- Overall email traffic
- Daily Exchange active user count by activity
- Mail statistics
- Email app usage
- Archive mailbox size
you can take a look at AdminDroid Microsoft 365 reporting and auditing tool.
Additionally, AdminDroid provides 1500+ pre-built reports and 20 smart visually appealing dashboards to know about your Office 365 environment at a glance. This tool provides reports on Office 365 reporting, auditing, analytics, usage statistics, security & compliance, etc.
Besides, AdminDroid provides over 100+ reports and a handful of dashboards completely for free. It includes reports on Users, Licenses, Groups, Group Members, Devices, Login Activities, Password Changes, License Changes, and more. The free edition doesn’t have any restrictions in reporting functionalities such as customization, scheduling, and exporting. For your Azure AD reporting and auditing needs, you can download Free Office 365 reporting tool by AdminDroid and see how it helps for you.
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.