Exchange 2010 – Get ItemCount for mailbox

Exchange LogoWe had a user that had a very large mailbox (313,000+ items and a size over 50GB) and we couldn’t figure out why. My first thought was that it was a corrupt mailbox and it was just reporting the wrong size. However, when I moved the mailbox to a new server the size remained the same and the move didn’t show any corrupted messages.

I sat down and looked at the mailbox on the users computer and checked the Inbox, Sent Items, and Deleted Items. None of those had any large messages. The largest message may have been 1MB. The user did have a lot of folders, but I didn’t want to take the time to go through each one individually and try to figure out where the messages were at.

So I went back to my desk and started my search for a PowerShell command that would give me the breakdown of those folders. It took several Google searches, but I finally got what I was looking for.

Below is the PowerShell script I ran in the Exchange Management Shell. It uses the Get-MailboxFolderStatistics cmdlet and exports the statistics to a CSV file. The CSV file has three columns (Name, ItemsInFolder, and FolderSize). The output is sorted by FolderSize in descending order.

Script:

Get-MailboxFolderStatistics -identity domainusername -folderscope all | select-object name,itemsinfolder,foldersize | sort foldersize -descending | export-csv c:output.csv


PDF pageEmail pagePrint page

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

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