exchange online powershell get all mailbox sizes

Master Exchange Online PowerShell: Get All Mailbox Sizes Instantly

By Steven Lee
AD

Effortlessly Retrieve All Mailbox Sizes in Exchange Online using PowerShell

In today's digital age, managing and monitoring mailbox sizes in a large-scale Exchange Online environment can be a daunting task. However, with the power of PowerShell, this process can be streamlined and automated. This guide will walk you through the steps to retrieve all mailbox sizes in Exchange Online using PowerShell.

Prerequisites

Before we dive into the process, ensure you have the following prerequisites in place:

  • Exchange Online PowerShell V2 module installed. If not, you can install it using the command: Install-Module -Name ExchangeOnlineManagement
  • Exchange Online administrator or appropriate permissions to run the commands
  • PowerShell 5.0 or later

Connecting to Exchange Online PowerShell

First, let's connect to Exchange Online PowerShell. Open PowerShell as an administrator and run the following command:

AD
9 Top Virtual Mailbox Providers
9 Top Virtual Mailbox Providers
Resource Center: Budget Mailboxes
Resource Center: Budget Mailboxes
Exploring Standard Mailbox Sizes with Visual Aids
Exploring Standard Mailbox Sizes with Visual Aids
Connect-ExchangeOnline -UserPrincipalName your-email@example.com -ShowProgress $true

Replace your-email@example.com with your Exchange Online administrator email. You'll be prompted to enter your password.

Retrieving All Mailbox Sizes

Now that we're connected, we can retrieve all mailbox sizes. We'll use the Get-MailboxStatistics cmdlet for this purpose. Run the following command:

an email address is shown in the form of a mailbox
an email address is shown in the form of a mailbox
a woman sitting in front of a red mailbox with a laptop on her lap
a woman sitting in front of a red mailbox with a laptop on her lap
three mailboxes in front of a large house
three mailboxes in front of a large house
Get-MailboxStatistics | Select-Object DisplayName, TotalItemSize, ItemCount

This command will display the display name, total item size (in bytes), and item count for each mailbox. However, this data is not sorted, and the output is quite extensive. Let's improve this.

Sorting and Filtering Mailbox Sizes

To make the output more manageable, we can sort and filter the results. For instance, to display only mailboxes with a total item size greater than 50GB (50,000,000,000 bytes) and sort them by size, use the following command:

AD
Get-MailboxStatistics | Where-Object { $_.TotalItemSize -gt 50000000000 } | Sort-Object TotalItemSize -Descending | Select-Object DisplayName, TotalItemSize, ItemCount

Exporting Mailbox Sizes to CSV

If you want to export the mailbox sizes to a CSV file for further analysis, you can use the following command:

13 Best Mailbox Ideas
13 Best Mailbox Ideas
Mailbox Post Plans - DIY Step-By-Step Plans - Construct101
Mailbox Post Plans - DIY Step-By-Step Plans - Construct101
15 Creative Double Mailbox Post Ideas for Your Front Yard
15 Creative Double Mailbox Post Ideas for Your Front Yard
the mailbox is open and ready to be delivered
the mailbox is open and ready to be delivered
24 Mailbox Ideas to Spruce Up Your Curb Appeal
24 Mailbox Ideas to Spruce Up Your Curb Appeal
an image of a mailbox and a post
an image of a mailbox and a post
Get-MailboxStatistics | Select-Object DisplayName, TotalItemSize, ItemCount | Export-Csv -Path C:\MailboxSizes.csv -NoTypeInformation

Disconnecting from Exchange Online PowerShell

Once you're done, don't forget to disconnect from Exchange Online PowerShell using the following command:

Disconnect-ExchangeOnline

Conclusion

Retrieving all mailbox sizes in Exchange Online using PowerShell is a powerful way to monitor and manage your mailbox environment. With the commands and tips provided in this guide, you can efficiently handle this task, ensuring that your mailboxes remain healthy and within your organization's storage policies.

AD
35 Creative Mailbox Designs That'll Make Neighbors Envious
35 Creative Mailbox Designs That'll Make Neighbors Envious
November 2015 - XPB Offers Lockers, Restroom Partitions, Sinks & Accessories - 877-483-9270
November 2015 - XPB Offers Lockers, Restroom Partitions, Sinks & Accessories - 877-483-9270
20 Modern Mailbox Ideas for a Stylish Curb Appeal
20 Modern Mailbox Ideas for a Stylish Curb Appeal
Mailbox kiosk
Mailbox kiosk
19+ Double Mailbox Post Ideas - TopReviewsAdviser
19+ Double Mailbox Post Ideas - TopReviewsAdviser
Pony Express, Rural Mailbox Regulations, Installing A Wall-mounted Mailbox, U.s. Mail Box Dimensions, Us Mailbox, Mailbox With Farm Sign
Pony Express, Rural Mailbox Regulations, Installing A Wall-mounted Mailbox, U.s. Mail Box Dimensions, Us Mailbox, Mailbox With Farm Sign
Vogue Traditional Cluster Box Unit
Vogue Traditional Cluster Box Unit
Buying A USPS Mailbox? A Buyers Guide - XPB Offers Lockers, Restroom Partitions, Sinks & Accessories - 877-483-9270
Buying A USPS Mailbox? A Buyers Guide - XPB Offers Lockers, Restroom Partitions, Sinks & Accessories - 877-483-9270
Mailbox Rentals at the Mailbox Store & Business Solutions
Mailbox Rentals at the Mailbox Store & Business Solutions
a man sitting on top of a metal bench in front of mailbox rentals
a man sitting on top of a metal bench in front of mailbox rentals
40 Mailbox Post Ideas To Upgrade Your Homes Exterior - PlusMood
40 Mailbox Post Ideas To Upgrade Your Homes Exterior - PlusMood
Mailbox Rental
Mailbox Rental
two black and white mailboxes in front of a house
two black and white mailboxes in front of a house
4B vs 4C Mailboxes: Key Differences Explained
4B vs 4C Mailboxes: Key Differences Explained
AD