Recipe 17.17. Viewing Mailbox Sizes and Message CountsProblemYou want to view the sizes and message counts of all mailboxes on a server. SolutionUsing a graphical user interface
Using VBScript' This code displays all mailboxes and their sizes ' ------ SCRIPT CONFIGURATION ------ strComputer = "<Exchange Server>" 'e.g., ExchServer2 ' ------ END CONFIGURATION --------- set objWMI = GetObject("winmgmts:\\" & strComputer & _ "\root\MicrosoftExchangeV2") set objMbxs = objWMI.ExecQuery("Select * from Exchange_Mailbox",,48) for each objMbx in objMbxs Wscript.Echo objMbx.MailBoxDisplayName & " " & objMbx.size & "KB " _ & objMbx.TotalItems & " items" Next Wscript.Echo "Script completed successfully." DiscussionMailbox sizes and message counts are items on Exchange systems that administrators routinely want to know about for the purposes of reporting and metrics. Administrators want to know if their mail system is balanced and if users are spread across the mailbox stores evenly. Knowing the number of users and the size of their mailboxes in each mailbox store, the administrator can make better decisions about where new user mailboxes should be placed or if some leveling of mailboxes is required.
Using a graphical user interfaceClick on the header of each of the columns displayed in the right pane of the ESM to sort by that value. Using VBScriptThis script can be modified to show several things for mailboxes. Some of the more notable items besides Size and Items are LastLogonTime, LastLoggedOnUserAccount, and DateDiscoveredAbsentInDS. Please reference the Exchange 2003 SDK for a complete list of items available in the Exchange_Mailbox class.
See AlsoExchange Server 2003 SDK: WMI Reference |