[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Exchange mailbox statistic

Posted on 2010-01-06
Medium Priority
Last Modified: 2012-06-21
Hi, I'm a newbie in Exchange and I would like to know how to get the statictic of the users mailbox in the exchange like:

- Size (Capacity of mailboxs)
- Used
- Free

It is a Exchange 2003 and most info that i got onlinei s powershell (No idea of how to use it) for exchange 2007. Any idea on how to generate this report?
Question by:otyew
  • 4
  • 4
  • 2
LVL 22

Accepted Solution

Syed Mutahir Ali earned 300 total points
ID: 26188756




' Date:      December 23, 2005

' Author:    Scott Lowe, starting with a sample script downloaded from

'            Microsoft

' Purpose:   Write the name of, size of, number of items in and status

'            of each users Exchange mailbox to a CSV file

' Change:    cComputerName to the name of an Exchange server

'            sOutFile to the name of the file you want to save to

' Output:    Displays the name of each Exchange_Mailbox's Size property

' Status:    1: Below Limit

'            2: Issue Warning

'            4: Prohibit Send

'            8: No Checking

'            16: Mailbox Disabled




On Error Resume Next

Dim cComputerName


cComputerName = "w2k3-std" ' <---- Change this to your Exchange server


Const cWMINameSpace = "root/MicrosoftExchangeV2"

Const cWMIInstance = "Exchange_Mailbox"


Dim oFSO             ' File system object to write to

Dim oOutputFile            ' Output file object

Dim sOutFile         ' Name of the output file


sOutFile = "C:\Scripts\sample.csv" ' <---- Change this



Dim sWinMgmts        ' Connection string for WMI

Dim oWMIExchange     ' Exchange Namespace WMI object

Dim lExchange_Mailboxes    ' ExchangeLogons collection

Dim oExchange_Mailbox      ' A single ExchangeLogon WMI object


' Open the output file for writing

Set oFSO = CreateObject("Scripting.FileSystemObject")

Set oOutputFile = oFSO.opentextfile(sOutFile, 2, True)


'Write a heading into the output file

oOutputFile.writeline("Mailbox name,Size (KB),# items,Status")


' Create the object string, indicating WMI (winmgmts), using the

' current user credentials (impersonationLevel=impersonate),

' on the computer specified in the constant cComputerName, and

' using the CIM namespace for the Exchange provider.

sWinMgmts = "winmgmts:{impersonationLevel=impersonate}!//"& _


Set oWMIExchange =  GetObject(sWinMgmts)


' Verify we were able to correctly set the object.

If Err.Number <> 0 Then

  oOutputFile.writeline("ERROR: " & err.number & ", " & err.description)



  ' The Resources that currently exist appear as a list of

  ' Exchange_Mailbox instances in the Exchange namespace.

  Set lExchange_Mailboxes = oWMIExchange.InstancesOf(cWMIInstance)


  ' Were any Exchange_Mailbox Instances returned?

  If (lExchange_Mailboxes.count > 0) Then

    ' If yes, do the following:

    ' Iterate through the list of Exchange_Mailbox objects.

    For Each oExchange_Mailbox in lExchange_Mailboxes


       oOutputFile.writeline("""" & _ 

           oExchange_Mailbox.MailboxDisplayName & _ 

           """," & _

           oExchange_Mailbox.Size & _

           ","& _

           oExchange_Mailbox.TotalItems & _

           ","& _





    ' If no Exchange_Mailbox instances were returned,

    ' display that.

    oOutputFile.writeline("WARNING: No Exchange_Mailbox instances were returned.")

  End If

End If

Open in new window

LVL 74

Assisted Solution

by:Glen Knight
Glen Knight earned 300 total points
ID: 26188762
There is no nativr way to do this with Exchange 2003 there may be 3rd party tools but none that are built in.

You could also try WMI scripting, see here for an example: http://techrepublic.com.com/5208-6230-0.html?forumID=3&threadID=189231&messageID=1950598&tag=content;leftCol
LVL 22

Expert Comment

by:Syed Mutahir Ali
ID: 26188910
Hi Otyew

The Script I have posted and the links are the same what "Demazter" has posted ; probably we both were writing at the same time, so don't get confused its the same script.

Hope this Helps

Do read the article in full (link provided in my post) so it will give you a good insight.

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

LVL 74

Expert Comment

by:Glen Knight
ID: 26189061
You could also have a look at this: http://www.imibo.com/imidev/Exchange/imims.htm

Author Comment

ID: 26198323
thanks guys but i am not allowed to use a 3rd party tools. btw, do i save the codes as .vbs and then run it in dos?

C:\> cscript codevbs
LVL 74

Expert Comment

by:Glen Knight
ID: 26198344
Yes its just a vbs script.

Author Comment

ID: 26198388
not really complete as there are no mailbox size of the users there. thanks btw...
LVL 74

Expert Comment

by:Glen Knight
ID: 26198406
You need to run it on the exchange server.

Unfortunately if 3rd party is out of the question then a Script based on WMI is going to be the only option.

Author Comment

ID: 26206723
it there possible to add another column for the users mailbox size?

Author Closing Comment

ID: 31673393

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Stellar Exchange Toolkit: this 5 in 1 toolkit comes loaded with mega-software tool. Here’s an introduction to tools’ usage and advantages:
This article will help to fix the below errors for MS Exchange Server 2016 I. Certificate error "name on the security certificate is invalid or does not match the name of the site" II. Out of Office not working III. Make Internal URLs and Externa…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question