exchange online powershell get mailbox sizes

Master Exchange Online PowerShell: Get Mailbox Sizes Fast

By Hannah Lewis
AD

In today's digital age, managing email storage efficiently is crucial, especially for businesses with large mailboxes. Exchange Online, a robust email service provided by Microsoft, allows you to monitor mailbox sizes to prevent storage issues. PowerShell, a powerful scripting language, can help you automate this task. Here's a comprehensive guide on how to get mailbox sizes using Exchange Online PowerShell.

Prerequisites

Before you start, ensure you have the following:

  • Exchange Online PowerShell V2 module installed. You can install it using the command Install-Module -Name ExchangeOnlineManagement.
  • Exchange Online administrator or mailbox permissions to run the scripts.

Connecting to Exchange Online PowerShell

First, you need to connect to Exchange Online PowerShell. Open PowerShell as an administrator and run the following command:

AD
9 Best Virtual Mailbox Providers to Use This Year
9 Best Virtual Mailbox Providers to Use This Year
an email address is shown in the form of a mailbox
an email address is shown in the form of a mailbox
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. Enter your password when prompted.

Getting Mailbox Sizes

Now that you're connected, you can retrieve mailbox sizes. Here's a simple command to get the size of all mailboxes:

Resource Center: Budget Mailboxes
Resource Center: Budget Mailboxes
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
Mailbox Post Plans - DIY Step-By-Step Plans - Construct101
Mailbox Post Plans - DIY Step-By-Step Plans - Construct101
Get-Mailbox -ResultSize Unlimited | Select-Object Name, TotalItemSize

This command will return a list of all mailboxes along with their total sizes. However, for larger environments, this might take a long time to execute. To speed up the process, you can use the following command:

Get-Mailbox -ResultSize Unlimited | ForEach-Object { Get-MailboxStatistics $_ } | Select-Object Name, TotalItemSize

This command uses the Get-MailboxStatistics cmdlet, which retrieves mailbox statistics in batches, making it faster for large environments.

AD

Filtering Mailbox Sizes

You can filter the results based on various parameters. Here are a few examples:

15 Creative Double Mailbox Post Ideas for Your Front Yard
15 Creative Double Mailbox Post Ideas for Your Front Yard
a mailbox with the text free mailbox template
a mailbox with the text free mailbox template
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
13 Best Mailbox Ideas
13 Best Mailbox Ideas
three mailboxes in front of a large house
three mailboxes in front of a large house
  • To get mailboxes larger than a specific size (e.g., 50GB):
Get-Mailbox -ResultSize Unlimited | ForEach-Object { Get-MailboxStatistics $_ } | Where-Object { $_.TotalItemSize -gt 50GB }
  • To get mailboxes in a specific organizational unit (OU):
Get-Mailbox -ResultSize Unlimited -OrganizationalUnit "OU=YourOU,DC=domain,DC=com" | ForEach-Object { Get-MailboxStatistics $_ }

Exporting Mailbox Sizes to CSV

You can export the mailbox sizes to a CSV file for further analysis. Here's how you can do it:

Get-Mailbox -ResultSize Unlimited | ForEach-Object { Get-MailboxStatistics $_ } | Select-Object Name, TotalItemSize | Export-Csv -Path "C:\MailboxSizes.csv" -NoTypeInformation

Disconnecting from Exchange Online PowerShell

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

AD
Disconnect-ExchangeOnline -Confirm:$false

This command disconnects the session and prevents any further commands from running.

35 Creative Mailbox Designs That'll Make Neighbors Envious
35 Creative Mailbox Designs That'll Make Neighbors Envious
the mailbox is open and ready to be delivered
the mailbox is open and ready to be delivered
20 Modern Mailbox Ideas for a Stylish Curb Appeal
20 Modern Mailbox Ideas for a Stylish Curb Appeal
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
Mailbox Post Magic: Home Inspiration
Mailbox Post Magic: Home Inspiration
a bunch of boxes that are on top of a wooden bench in the grass near some trees
a bunch of boxes that are on top of a wooden bench in the grass near some trees
40 Mailbox Post Ideas To Upgrade Your Homes Exterior - PlusMood
40 Mailbox Post Ideas To Upgrade Your Homes Exterior - PlusMood
Mailbox Project Plans Two Styles – You've Got Mail, We've Got DIY Plans
Mailbox Project Plans Two Styles – You've Got Mail, We've Got DIY Plans
18 Types of Mailboxes, Material Options and Functions
18 Types of Mailboxes, Material Options and Functions
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
19+ Double Mailbox Post Ideas - TopReviewsAdviser
19+ Double Mailbox Post Ideas - TopReviewsAdviser
Mailbox kiosk
Mailbox kiosk
two black and white mailboxes in front of a house
two black and white mailboxes in front of a house

Monitoring mailbox sizes is a crucial task in Exchange Online administration. With these PowerShell commands, you can efficiently manage your mailboxes and prevent storage issues. Regularly checking and cleaning up large mailboxes can help maintain a healthy and efficient Exchange Online environment.

AD