Exchange 2007 Mailbox Statistics and Quotas

Great way to find out a lot of information on all mailboxes on an exchange server, specifically mailbox quotas.

$today = get-date
$rundate = $($today.adddays(-1)).toshortdatestring()

$outfile_date = ([datetime]$rundate).tostring("yyyy_MM_dd")
$outfile = $outfile_date + ".csv"

Get-Mailbox -ResultSize Unlimited | Select-Object DisplayName, @{label="StorageLimitStatus";expression={(Get-MailboxStatistics $_).StorageLimitStatus}}, IssueWarningQuota, ProhibitSendQuota, @{label="TotalItemSize(MB)";expression={(Get-MailboxStatistics $_).TotalItemSize.Value.ToMB()}}, @{label="ItemCount";expression={(Get-MailboxStatistics $_).ItemCount}}, Database | Export-csv "\\your-file-path-here\$outfile" -NoTypeInformation