Here is a script that will report your top 20 largest mailboxes. This could easily be changed to report the top 5 or top 50. You can also use my previous post to schedule this to run every morning or once a month.
There is additional code here to send to to your mailbox so you don’t have to go and track it down. You know the status just by looking at your email (which you do anyway).
$subject = "Exchange 2010 Mailbox Statistics"
$mailboxes = Get-Mailbox -ResultSize 'Unlimited' -RecipientTypeDetails Usermailbox | Get-MailboxStatistics | Sort TotalItemSize -desc | select-object DisplayName,ItemCount,TotalItemSize -First 20
$20LargestMailboxes = $mailboxes | ConvertTo-HTML -fragment
$Head = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd.dtd'><html xmlns='http://www.w3.org/1999/xhtml'><head><style type='text/css'>TABLE{font-family: verdana,arial,sans-serif;font-size:11px;color:#333333;border-width: 1px;border-color: #a9c6c9;border-collapse: collapse;background-color:#a9c6c9;}TH{border-width: 1px;padding: 8px;border-style: solid;border-color: #a9c6c9;}TD{border-width: 1px;padding: 8px;border-style: solid;border-color: #a9c6c9;background-color:#d4e3e5;}</style></head>"
$Body = "<body><p><h2>Top 20 Largest Exchange 2010
Mailboxes</h2>$20LargestMailboxes</p>"
$Tail = "<p>This script is run from PUTIL2DSM. D:\PSScripts\MailboxStats.ps1.</p>"
$Message = $Head + $Body + $Tail
Send-MailMessage -To me@mydomain.com -From you@yourdomain.com -Subject $subject -SmtpServer server.mydomain.com -Body $Message -BodyAsHtml
Now, a bit of explaination of the code…
The variables $subject, $head, $body, $tail & $message all have to do with the sending of the email. the $head is where the table is built. If you don’t like the look of the table, try modifying this variable.
$Body is the table itself including the table header
$Tail is just a reminder as to where this script is ran from so the person that follows me will have a chance of finding it to modify it.
The $Message is the combination of all three. Make sure you update the Send-MailMessage line with your specific details. Otherwise, you will not get the email.
So, the Exchange specific line is really just the one or two at the top. Study it and let me know if you have questions.
Here is a sample of what the email will look like.
