Disclaimer
This is my personal blog. The opinions and views I express are my own. The information I provide is on an as-is basis. I make no representations as to accuracy, completeness, currentness, suitability, or validity of any information on this blog and will not be liable for any errors, omissions, or delays in this information or any losses, injuries or damages arising from its use.

Get Exchange 2010 Mailbox size (Powershell)

*** THIS SCRIPT IS PROVIDED WITHOUT WARRANTY, USE AT YOUR OWN RISK ***

This script will query all mailboxes on the server name you supply. It returns the Display Name, Total Mailbox size in MBs, Item count (number of messages in the mailbox) and the Storage Limit Status (has the user met the limit or not) sorted by the mailbox size. The script writes all this info to the mailbox_size.csv in the directory you input.

This script has to be run from the Exchange Management Shell.

Tested on Windows Server 2K8 running Exchange 2010 SP2.

$dir = read-host "Directory to save the CSV file"
$server = read-host "Exchange Server Name"

get-mailboxstatistics -server $server | where {$_.ObjectClass -eq "Mailbox"} | 
Select DisplayName,TotalItemSize,ItemCount,StorageLimitStatus | 
Sort-Object TotalItemSize -Desc |
export-csv "$dir\mailbox_size.csv"

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.