Not too long ago, I received a ticket from a user who was having quota issues and could not account for what was using up their Exchange quota. With a simple Exchange Management Shell one-liner, I was able to provide a list of every folder in that user’s mailbox, the number of items in each folder, and size of the folder contents:
[PS] E:\working\scripts>Get-MailboxFolderStatistics jane.user | sort-object item
sinfolder -descending | ft Name, FolderPath, ItemsInFolder, FolderSize -auto
Name FolderPath ItemsInFolder FolderSize
---- ---------- ------------- ----------
Inbox /Inbox 33 103574B
Calendar /Calendar 25 64012B
Deleted Items /Deleted Items 7 9101B
Sent Items /Sent Items 6 7690B
Notes /Notes 0 0B
Outbox /Outbox 0 0B
Tasks /Tasks 0 0B
RSS Feeds /RSS Feeds 0 0B
Contacts /Contacts 0 0B
Top of Information Store / 0 0B
Drafts /Drafts 0 0B
Junk E-Mail /Junk E-Mail 0 0B
Journal /Journal 0 0B
But wait, there’s more. As mentioned in my previous article, I’ve encountered issues with folders which have leading or trailing whitespace in their name. Sure enough, I was able to crank out a simple one-liner to list all folders possessing this defect:
[PS] E:\working\scripts>get-mailbox -resultsize unlimited | Get-MailboxFolderSta
tistics | where {($_.Name -like "* ") -or ($_.Name -like " *")} | fl Name,Identi
ty,FolderPath
[PS] E:\working\scripts>get-mailbox -resultsize unlimited | Get-MailboxFolderSta
tistics | where {($_.Name -like "* ") -or ($_.Name -like " *")} | fl Name,Identi
ty,FolderPath