Problem sorting users by mailbox size in EMS (Powershell)
This is the command:Get-MailboxStatistics |where {$_.displayname -notlike "*System*"} |Sort-Object -Descending "Mailbox Size(kb)"|ft displayname, @{expression={$_.totalitemsize.value.ToKB()};width=20;label="Mailbox Size(kb)"},ItemCount This is the output: DisplayName Mailbox Size(kb----------- ---------------Cindy Smith 488Andy Jones 303Nancy Miller 812Jim SmithConnie Anderson11018Sara Jones 114Marge Hill 46Kelly Smith 423Gina Heller 2567PROBLEMS:1) ItemCount does not display.2) Not sorted in descending order.Can anyone see what is wrong with the command (copied and pasted from the EMS)?
August 19th, 2009 9:46pm

"Mailbox Size(kb)" is not returned by Get-MailboxStatistics - so you can't sort on it.Try this:Get-MailboxStatistics | where {$_.displayname -notlike "*System*"} | Sort-Object -Descending "totalitemsize"| ft displayname, @{expression={$_.totalitemsize.value.ToKB()};width=20;label="Mailbox Size(kb)"},ItemCountKarl
Free Windows Admin Tool Kit Click here and download it now
August 19th, 2009 11:09pm

Cool! I tested in the lab, it works. And you can add -wrap if theres any name just too long Get-MailboxStatistics | where {$_.displayname -notlike "*System*"} | Sort-Object -Descending "totalitemsize"| ft displayname,@{expression={$_.totalitemsize.value.ToKB()};width=20;label="Mailbox Size(kb)"},ItemCount -wrap
August 20th, 2009 9:46am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics