Script to get Mailbox Information

I was deploying archiving solution for Exchange 2010 for more than 20K seats environment. And I have been asked by the vendor to find certain information for all the Mailboxes in exchange environment, like TotalItemSize, TotalDeletedItemSize, ItemCount and DeletedItemCount.

I came up with the below script which made the JOB easy. I ran the script per Exchange Server, but you can also run it per Mailbox Database, you just need to change the switch from -Server to -Database.

Get-Mailbox -Server "MailboxServerName" -ResultSize Unlimited -IgnoreDefaultScope -RecipientTypeDetails UserMailbox,RoomMailbox,EquipmentMailbox,SharedMailbox | Get-MailboxStatistics | Select DisplayName,@{expression={$_.TotalItemSize.value.ToMB()};label="TotalItemSize(MB)"},@{expression={$_.TotalDeletedItemSize.Value.ToMB()};Label="TotalDeletedItemSize(MB)"},ItemCount,DeletedItemCount,Database,OrganizationalUnit | Export-Csv C:\temp\Content.csv

If you want to run it across your Exchange environment without using Server or Database switch, then just run Get-Mailbox only.
You can also add other attributes like SentItems, Attachment etc. to the script.
This script can be run on Exchange Server 2010 and 2013.

Cheers,

Leave a Reply

EXCHANGE RANGER