In part 1 I looked at how to retrieve mailbox information from Exchange 2003 using WMI and Powershell.
Taking this on one step further along the lines of your manager asks for a list of the biggest Exchange mailboxes, we can use a similar command to get the mailbox info, sort the list by size and then use the -First parameter of the Select-Object cmdlet to bring back only the top 10 say.
Its as easy as that. Of course you could then output the data to a csv file using an additional pipeline so that the info is easy to forward on.
Get-Wmiobject -namespace root\MicrosoftExchangeV2 -class Exchange_Mailbox -computer ExchangeServerName | sort-object Size -Descending | select-object -First 10 MailboxDisplayName,Servername,StorageGroupName,StoreName,Size | export-csv c:\scripts\top10.csv
Hi Jonathan
ReplyDeleteCan you contact me at :
scriptolog[AT]gmail[dot]com
---
Shay Levy
http://blogs.microsoft.co.il/blogs/ScriptFanatic