Exchange_Mailbox Class

Exchange_Mailbox Class

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

The Exchange_Mailbox WMI class has properties that return information about Microsoft® Exchange mailboxes.




The ExchangeMapiTableProvider supplies instances of the Exchange_Mailbox class.


The Exchange_Mailbox class extends the CIM_LogicalElement class.




Property Description
LegacyDN Property
[key, read] string LegacyDN;

The LegacyDN property indicates the legacyDN of the mailbox and matches the legacyExchangeDN attribute of the user object in Microsoft Active Directory®.

MailboxGUID Property
[key, read] string MailboxGUID;

The MailboxGUID property indicates the globally unique identifier (GUID) that links the mailbox to a user in Active Directory.

ServerName Property
[key, read] string ServerName;

The ServerName property indicates the name of the server where the mailbox resides.

StorageGroupName Property
 read] string StorageGroupName;

The StorageGroupName property indicates the name of the storage group that contains the mailbox.

StoreName Property
[key, read] string StoreName;

The StoreName property indicates the name of the message database (MDB) that contains the mailbox.

AssocContentCount Property
[read] uint32 AssocContentCount;

The AssocContentCount property indicates the total number of messages associated with the mailbox folders.

DateDiscoveredAbsentInDS Property
[read] datetime DateDiscoveredAbsentInDS;

The DateDiscoveredAbsentInDS property indicates when the store detected that the mailbox no longer had a corresponding user entry in Active Directory. Mailboxes without Active Directory user entries are known as disconnected mailboxes.

DeletedMessageSizeExtended Property
 Units("Bytes")] uint64 DeletedMessageSizeExtended;

The DeletedMessageSizeExtended property indicates the cumulative size of all deleted messages that are still being retained according to retention policy settings.

LastLoggedOnUserAccount Property
[read] string LastLoggedOnUserAccount;

The LastLoggedOnUserAccount property indicates the account name last used to log on to the mailbox.

LastLogoffTime Property
[read] datetime LastLogoffTime;

The LastLogoffTime property indicates the time that the last user logged off.

LastLogonTime Property
[read] datetime LastLogonTime;

The LastLogonTime property indicates the time that the last user logged on.

MailboxDisplayName Property
[read] string MailboxDisplayName;

The MailboxDisplayName property indicates the display name of the mailbox and matches the displayName attribute in Active Directory.

Size Property
 Units("Bytes")] uint64 Size;

The Size property indicates the cumulative size of all of the messages in the mailbox, in bytes.

StorageLimitInfo Property
 Values{"Below Limit", "Issue Warning",
   "Prohibit Send", "No Checking",
   "Mailbox Disabled"},
 ValueMap{"1", "2", "4", "8",
   "16"}] uint32 StorageLimitInfo;

The StorageLimitInfo property contains the storage limit settings on the mailbox.

TotalItems Property
[read] uint32 TotalItems;

The TotalItems property indicates the total number of messages in the mailbox.


Method Description
Purge Method
[implemented] void Purge();

The Purge method removes the mailbox from the store permanently. The Purge method is available only if the mailbox is disconnected.

Reconnect Method
[implemented] void Reconnect(
  [in] string UserLogonName);

The Reconnect method allows a disconnected mailbox to be reconnected to an existing user object in Active Directory. The user must not already be mail-enabled.


This class has no associations.

VBScript Example

The following example shows how to retrieve a list of Exchange_Mailbox instances, and how to retrieve all the associated properties.

' Purpose:   Display each Exchange_Mailbox found for Exchange server,
'            and show all properties on the Exchange_Mailbox
'            objects
' Change:    cComputerName [string] the computer to access
' Output:    Displays the name of each Exchange_Mailbox and properties

On Error Resume Next
Dim cComputerName
Const cWMINameSpace = "root/MicrosoftExchangeV2"
Const cWMIInstance = "Exchange_Mailbox"
cComputerName = "MyComputerNETBIOSName"

Dim strWinMgmts		' Connection string for WMI
Dim objWMIExchange	' Exchange Namespace WMI object
Dim listExchange_Mailboxs	' ExchangeLogons collection
Dim objExchange_Mailbox		' A single ExchangeLogon WMI object

' 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.
strWinMgmts = "winmgmts:{impersonationLevel=impersonate}!//"& _
Set objWMIExchange =  GetObject(strWinMgmts)
' Verify we were able to correctly set the object.
If Err.Number <> 0 Then
  WScript.Echo "ERROR: Unable to connect to the WMI namespace."
  ' The Resources that currently exist appear as a list of
  ' Exchange_Mailbox instances in the Exchange namespace.
  Set listExchange_Mailboxs = objWMIExchange.InstancesOf(cWMIInstance)
  ' Were any Exchange_Mailbox Instances returned?
  If (listExchange_Mailboxs.count > 0) Then
    ' If yes, do the following:
    ' Iterate through the list of Exchange_Mailbox objects.
    For Each objExchange_Mailbox in listExchange_Mailboxs
       ' Display the value of the AssocContentCount property.
       WScript.echo "AssocContentCount        = "& _
        " ["&TypeName(objExchange_Mailbox.AssocContentCount)&"] "& _
       ' Display the value of the DateDiscoveredAbsentInDS property.
       WScript.echo "DateDiscoveredAbsentInDS = "& _
        " ["&TypeName(objExchange_Mailbox.DateDiscoveredAbsentInDS)&"] "& _
       ' Display the value of the DeletedMessageSizeExtended property.
       WScript.echo "DeletedMessageSizeExtended= "& _
        " ["&TypeName(objExchange_Mailbox.DeletedMessageSizeExtended)&"] "& _
       ' Display the value of the LastLoggedOnUserAccount property.
       WScript.echo "LastLoggedOnUserAccount  = "& _
        " ["&TypeName(objExchange_Mailbox.LastLoggedOnUserAccount)&"] "& _
       ' Display the value of the LastLogoffTime property.
       WScript.echo "LastLogoffTime           = "& _
        " ["&TypeName(objExchange_Mailbox.LastLogoffTime)&"] "& _
       ' Display the value of the LastLogonTime property.
       WScript.echo "LastLogonTime            = "& _
        " ["&TypeName(objExchange_Mailbox.LastLogonTime)&"] "& _
       ' Display the value of the LegacyDN property.
       WScript.echo "LegacyDN                 = "& _
        " ["&TypeName(objExchange_Mailbox.LegacyDN)&"] "& _
       ' Display the value of the MailboxDisplayName property.
       WScript.echo "MailboxDisplayName       = "& _
        " ["&TypeName(objExchange_Mailbox.MailboxDisplayName)&"] "& _
       ' Display the value of the MailboxGUID property.
       WScript.echo "MailboxGUID              = "& _
        " ["&TypeName(objExchange_Mailbox.MailboxGUID)&"] "& _
       ' Display the value of the ServerName property.
       WScript.echo "ServerName               = "& _
        " ["&TypeName(objExchange_Mailbox.ServerName)&"] "& _
       ' Display the value of the Size property.
       WScript.echo "Size                     = "& _
        " ["&TypeName(objExchange_Mailbox.Size)&"] "& _
       ' Display the value of the StorageGroupName property.
       WScript.echo "StorageGroupName         = "& _
        " ["&TypeName(objExchange_Mailbox.StorageGroupName)&"] "& _
       ' Display the value of the StorageLimitInfo property.
       WScript.echo "StorageLimitInfo         = "& _
        " ["&TypeName(objExchange_Mailbox.StorageLimitInfo)&"] "& _
       ' Display the value of the StoreName property.
       WScript.echo "StoreName                = "& _
        " ["&TypeName(objExchange_Mailbox.StoreName)&"] "& _
       ' Display the value of the TotalItems property.
       WScript.echo "TotalItems               = "& _
        " ["&TypeName(objExchange_Mailbox.TotalItems)&"] "& _
    ' If no Exchange_Mailbox instances were returned,
    ' display that.
    WScript.Echo "WARNING: No Exchange_Mailbox instances were returned."
  End If
End If

Send us your feedback about the Microsoft Exchange Server 2003 SDK.

This topic last updated: March 2007

Build: June 2007 (2007.618.1)

© 2003-2006 Microsoft Corporation. All rights reserved. Terms of use.