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()