Short Description
An Exchange Server container of email messages, calendar events, task items, and personal contacts.
Details and Remarks
A mailbox is a fundamental object of an Exchange server. A mailbox is a logical container of data in which all items associated with it are stored. A mailbox can have several identities depending on how it is to be used. A mailbox is also an “addressable” object which allows it to receive messages via a mail transport service.
| Identity Type | Remarks |
|---|---|
| Primary Email Address | An SMTP address type that uniquely identifies a mailbox. A mailbox must have a primary SMTP address. The address must be unique across all domains in an Active Directory Forest. PowerShell Property Name: PrimarySmtpAddress LDAP Property Name: mail Note: The primary smtp address is also found in the email addresses list of the Active Directory object. The value can be identified as the only value that starts with SMTP: in all capital letters. |
| LegacyExchangeDN | This value is unique for every mail-enabled object in the Microsoft Exchange system. The value is in the format of an X500 address. The value and its format are currently a holdover from Exchange 5.0 and Microsoft’s first use of a network directory. The X500 address is commonly formatted similar to: /O=OrganizationName/OU=GroupOrContainer/CN=TypeName/CN=ObjectName |
| Windows DistinguishedName | Every mailbox in exchange, exclusive of the Archive Mailbox, requires an object to exist in Microsoft Active Directory. Every Active Directory object has a unique identifier called a DistinguishedName which is a full-path identifer of the object, including the Active Directory domain name. The DistinguishedName value is common formatted similar to: cn=objectName, ou=containerName, dc=contoso, dc=com There is no correlation between a Windows DN and the LegacyExchangeDN. |
| Canonical Path | The canonical path is a transformation of the Windows DistinguishedName value. The order of the container elements in the path are reversed and the element designators are removed. Example: contoso.com/container1/container2/objectName |
| ObjectGuid | The ObjectGuid value is the absolute unique identifier of the Active Directory object. The value is immutable and if the object is deleted, the ObjectGuid can only be restored by restoring the entire object, if not already purged from the Active Directory database. |
| ExchangeGuid | The ExchangeGuid is a Microsoft Exchange value that is stored on the Active Directory object. The LDAP name for this value is msExchMailboxGuid. This value is the absolute unique identifier of the mailbox inside the Exchange mailbox database. While the value can be changed on the Active Directory object, doing so will either cause a new mailbox to be created in the Exchange database or will connect to an existing mailbox with the value. The value inside the Exchange database is immutable. |
Active Directory Dependency
Mailboxes are a 2-part object, one part database data another part Active Directory object. All mailboxes require an Active Directory object which contains the email addresses, database assignment, restrictions, and some permissions. This is true for on-premises Exchange as well as Office 365 Exchange Online.
In order for a mailbox to be valid, a specific set of Active Directory properties must exist on the object. If any of the following properties are empty or missing, the mailbox will not be visible to Exchange and a user may lose access to their mailbox.
All mailboxes except for the System Mailbox use an Active Directory User object. The System Mailbox is a special object that has its own Active Directory schema type (msExchSystemMailbox).
| LDAP Property | POwershell Property | Remarks |
|---|---|---|
| PrimarySmtpAddress | The primary SMTP address of the mailbox | |
| proxyAddresses | EmailAddresses | The entire list of addresses for the mailbox, including the Primary SMTP Address. Each address in the list must be preceded by a type specifier followed by a colon character. The type specifier is required to be alphanumeric characters only and within a group of addresses of the same type one must have the type specifier in ALL CAPITAL letters to identify the primary address of that type. Commonly seen address types are: SMTP, X500, SIP, RTS. Third-party applications may also have their own types for their own use. A common 3rd party type is RFAX which is an enterprise faxing software that can deliver faxes to users’ mailboxes. In many on-premises environment there may be several older and now unused address types, such as: X400, MS, CCMAIL, and NOTES. |
| mailNickName | Alias | A simple text value that identifies the mailbox. The alias value is used as a shorter alternative in Outlook for selecting a recipient. The alias value is used by Exchange when generating a default primary SMTP address for a new mail mailbox when no matching email address policy exists. |
| homeMdb | Database | The mailbox database that holds the mailbox data. The value is stored in Active Directory as a Windows DistinguishedName value. Changing this value does not move a mailbox to another database. While this property can be changed, doing so without a full understanding of how Exchange works can cause a user to lose their mailbox. |
| msExchHomeServerName | ServerLegacyDN | This is the X500 address value of the Exchange server hosting the database for the mailbox. This value is less critical than it was with Exchange 2003 and earlier but is still required. Note that this value does not necessarily identify the current active copy of a database availability group (DAG). |
| msExchMailboxGuid | ExchangeGuid | This is the absolute unique identifier of a mailbox. It must be unique within the database. It is recommended that this value be unique across all databases. This value should not be modified directly. Creating a new value when a mailbox already exists will cause a new empty mailbox to be created and the previous mailbox will be marked for deletion based on retention policies. |
Common and Interesting Powershell Commands
Get All Mailboxes
$allMailboxes = Get-Mailbox -ResultSize Unlimited
Get Mailbox Sizes and Item Counts
NOTE: Running this command across 100s or 1000s of mailboxes is very slow and can take many minutes or possibly hours to complete. The Get-MailboxStatistics command is inherently slow and forces the Exchange server to retrieve current stats from each mailbox from the mailbox database.
Invoke-Command {
$allMailboxes = Get-Mailbox -ResultSize Unlimited
foreach ($mbx in $allMailboxes) {
$stat = Get-MailboxStatistics -Identity $mbx.guid
[pscustomobject]@{Name = $mbx.displayname; Identity = $mbx.identity; TotalItems = $stat.ItemCount; TotalSize = [int64][regex]::match($stat.TotalItemSize.ToString(), '(?<=\()[0-9,]+').Value; TotalSizeText = [regex]::match($stat.TotalItemSize.ToString(), '^\s*[0-9,.]+\s*[BKMGytes]+').Value }
}
} | Out-GridView
