Chat with us, powered by LiveChat

Blog

Back

Export all Mailbox Sizes to CSV using Powershell on Office 365

23 Aug 2012 by Emma Robinson

Want to save this blog for later? Download it now.

This Powershell script will connect to Office 365 and export all mailbox sizes to a CSV file. If you don’t have time to get into Powershell, why not try our Office 365 Reporting product?

Otherwise, a lot of people suggest we just run the following command:

This does almost the same thing as our script below, but offers a lot less control. Also, we love writing scripts!

The script accepts three parameters.

  1. Your Office 365 Administrator Username
  2. Your Office 365 Administrator Password
  3. An input file path (optional)

When you run the script without an input file specified it will connect to Office 365 and collect the mailbox sizes for all users in the tenant. It will output those to a file called MailboxSizes.csv with the following format

Read more Optimizing PowerShell for large Office 365 tenants.

You may notice this line and wonder what is going on?

Office 365 outputs the TotalItemSize as a string rather than numbers. In Exchange 2010 we are normally able to do something like $objUserMailbox.TotalItemSize.Value.ToMB(). Unfortunately, this functionality doesn’t exist in Office 365.

Here is the script:

If you found this blog post useful, and want to refer to it again, why not download it as a PDF?

whois: Andy White Freelance WordPress Developer London