Get-MailboxStatistics -Server “Server Name” | Sort -Property TotalItemsize | Select DisplayName, LastLoggedOnUserAccount, ItemCount, @{expression={$_.totalitemsize.value.ToMB()};label=”Size(MB)”}, LastLogonTime, LastLogoffTime | Export-CSV mailboxes.csvRunning this command in Exchange Management Shell will generate a CSV file containing mailbox information for your Exchange server, display sizes in MB and sort the results from smallest to largest.
This command can be adapted to display information from a database rather than server, or for an individual user by changing the -Server “Server Name” parameter to;
-Database "Database Name"
or
-Identity "Username"
You can also specify other parameters to display in the CSV report;
AssociatedItemCount
DatabaseName
DeletedItemCount
DisconnectDate
DisplayName
ItemCount
LastLoggedOnUserAccount
LastLogoffTime
LastLogonTime
LegacyDN
MailboxGuid
ServerName
StorageGroupName
StorageLimitStatus
TotalDeletedItemSize
TotalItemSize