Exchange mailbox statistic

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?
Who is Participating?
Syed Mutahir AliTechnology ConsultantCommented:



' 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

Glen KnightCommented:
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:;leftCol
Syed Mutahir AliTechnology ConsultantCommented:
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.

Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

Glen KnightCommented:
You could also have a look at this:
otyewAuthor Commented:
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
Glen KnightCommented:
Yes its just a vbs script.
otyewAuthor Commented:
not really complete as there are no mailbox size of the users there. thanks btw...
Glen KnightCommented:
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.
otyewAuthor Commented:
it there possible to add another column for the users mailbox size?
otyewAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.