The ability to gather mailbox information in Exchange 2007 and 2010 was vastly improved via Powershell. As Exchange engineers we’ve been tasked with retrieving various informational reports on user mailboxes. The scripts you will find below were created specifically for this purpose.
In the example script below we’ve split reporting out into 2 categories. In the first one we pull information on all mailboxes where “customattribute7” does not contain the word exempt. This script gathers a user’s display name , total item counts per mailbox, and overall mailbox size. It converts the mailbox size information into MB format and finally puts the information into a text file located on our file server.
Get-Mailbox | where { $_.customattribute7 -ne “exempt” } | Get-MailboxStatistics | select displayname, itemcount, TotalItemSize | sort-object totalitemsize -descending | format-table displayname, itemcount, @{expression= {$_.TotalItemSize.value.ToMB()};label=”TotalItemSize(MB)”} -Auto > “\\fileserver\reports\mailboxinfo.txt”
Example Output:
DisplayName ItemCount TotalItemSize(MB)
Test, User 32327 1437
The second script performs exactly the same function except it will report on only users where “customattribute7” contains the word exempt
Get-Mailbox | where { $_.customattribute7 -eq “exempt” } | Get-MailboxStatistics | select displayname, itemcount, TotalItemSize | sort-object totalitemsize -descending | format-table displayname, itemcount, @{expression= {$_.TotalItemSize.value.ToMB()};label=”TotalItemSize(MB)”} -Auto > “\\fileserver\reports\mailboxinfo.txt”
More Mailbox Information commands will be posted shortly