Get-MailboxStatistics to export Mailbox size in Exchange Powershell

Use the below to export mailbox statistics from exchange PowerShell. There are different commands which help you filter and manipulate the exported data.

The exported information is always useful during Office 365 migration to assess mailbox sizes and item counts, last login time and required bandwidth.

Export Mailbox size and statistics of all users
get-mailbox  -resultsize unlimited | get-mailboxstatistics | ft DisplayName,TotalItemSize,Itemcount | export-csv C:\temp\mailboxstatistics.csv
Export Mailbox statistics for a specific OU (organizational unit)

get-mailbox -OrganizationalUnit  “OU=Sales,OU=London Staff,DC=contoso,DC=local” -resultsize unlimited | get-mailboxstatistics | ft DisplayName,TotalItemSize,Itemcount | export-csv C:\temp\salesstaffmbstats.csv

Export Mailbox statistics based on domain address

In this example we use the where cmdlet to specify the search filter base. In the below example I am searching for users with specific email address, useful in a multi tenant environment.

Here I am trying to export mailbox statistics for specific set of users who have exchangekb as their email address suffix.

get-mailbox | where {$_.EmailAddresses -like “*exchangekb*”} | get-mailboxstatistics | select-object displayname, totalitemsize, itemcount, lastlogontime, exchangeguid | export-csv C:\temp\exchangekbstats.csv

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.