Grepping MailboxFolderStatistics

I am trying to get the the mailbox folder sizes for a user with many folders. Wouldn’t it be great if I could just:

get-mailboxfolderstatistics USER | grep “foldernamepattern” | ft

Obviously this does not work so:

Get-MailboxFolderStatistics USER | Where { $_.Name -match “pattern*” } | sort -desc FolderSize | ft Name,ItemsInFolder,@{expression={$_.FolderSize.ToKB()};Label=”Folder Size (KB)”},@{expression={$_.FolderAndSubFolderSize.ToKB()};Label=”Folder and SubFolder Size (KB)”} -auto

Note the omission of Value in Get-MailboxFolderStatistics which uses the expression:

$_.FolderAndSubFolderSize.ToKB()

whereas Get-MailboxStatistics uses:

$_.TotalItemSize.Value.ToMB()

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>