Powershell to get top 100 mailboxes in the Exchange 2007 server

Below Powershell script gets you the top 100 mailboxes from an Exchange 2007 server in the sorted format

Get-MailboxStatistics |sort totalitemsize -des | select-object Displayname, ItemCount,@{name=’TotalItemSize(MB)’;expression={$_.totalitemsize/1MB}}  -first 100

Top address 100 mailbox in the specific Exchange server. You can always modify the count as per your requirement. -first xxx has to modified to get the expected count result.

$MailboxServer = <servername>

Get-MailboxStatistics | ?{$_.ServerName -eq $MailboxServer }|sort totalitemsize -des | select-object Displayname, ItemCount,@{name=’TotalItemSize(MB)’;expression={$_.totalitemsize/1MB}}  -first 100

 

Below powershell will get the list of top 10 mailbox from the specific Exchange database or Store

$database = <database>
Get-MailboxStatistics | ?{$_.Database -eq $database}|sort totalitemsize -des | select-object Displayname, ItemCount,@{name=’TotalItemSize(MB)’;expression={$_.totalitemsize/1MB}}  -first 10