• Greg Zejer

Exchange PowerShell – Pull Mailbox Statistics

Exchange data is something that always needs looking into, mainly mailbox sizes. A lot of companies implement size limitations, only to be overridden by a request the user makes to increase the size.

PowerShell is a powerful tool that honestly, I don’t remember how I lived without it (kind of like GPS and smartphones).

If you open the Exchange Management Shell, you can pull reports on users to find the biggest mailboxes.

First, you want to only pull users that are enabled: Get-User -RecipientTypeDetails UserMailbox -ResultSize Unlimited | ? {$_.Useraccountcontrol -notlike “*accountdisabled*”} This will narrow it down to the users that count. Then you want to pull the mailbox statistics and select the columns that matter to you. For example, my query is: Get-User -RecipientTypeDetails UserMailbox -ResultSize Unlimited | ? {$_.Useraccountcontrol -notlike “*accountdisabled*”} | Get-MailboxStatistics | Sort-Object TotalItemSize -descending | Select-Object DisplayName,ItemCount,@{name=”MailboxSize”;exp={$_.TotalItemSize}} -first 15 This will return the top 15 mailboxes.

In other situations, you can pull a full list of all disabled mailboxes to understand how much space you can save if you get rid of them all (just change the Where statement to ‘-like’ instead of ‘-notlike’.

Get creative with other fields as well and narrow down your search.

One thing to note: As of this writing, if you use PSSession into the Exchange server from a Windows 10 machine, sorting via the mailbox size does not work. No idea why, if you happen to know or have ideas on how to do it, please comment below.

Chicago – North Shore

899 Skokie Blvd. Suite 520
Northbrook, IL 60062

Phone: 847-464-3900

sales@globalpointllc.com

Chicago – Downtown

27 N. Wacker Dr. Suite 910
Chicago, IL 60606

Phone: 312-582-4343

sales@globalpointllc.com

Detroit Michigan

888 West Big Beaver Rd. Suite 200
Troy, MI 48084

248-929-5800

sales@globalpointllc.com