In Office 365 recipients may have different mailbox types. A mailbox enabled user may have one or more archive mailboxes or a guest user that you have invited to interact with organization groups may have a component shared mailbox.
I recently participated in an escalation where there was a need to understand how many mailboxes were enabled with archives and how many of those archives had been auto expanded.
Prior to the release of the Exchange Management PowerShell version 3.0 administrators had access to a command called Get-MailboxLocations. In the new PowerShell this command was replaced with Get-MailboxLocation. (Notice the subtle difference). The usage of the command has also changed significantly allowing for the passing of either an identity or user object and allowing the scoping of the command to return either all or specific mailbox types. Information on get-mailboxLocation can be found at: Get-MailboxLocation (ExchangePowerShell) | Microsoft Learn
I have published a sample script to the following location: timmcmic/MailboxLocationsReport (github.com)
To utilize the script an Exchange Management PowerShell session must be opened and authenticated. When running the script, the administrator is presented with six predefined options.
- Collect all recipients that can have a mailbox. This covers primary mailboxes, archive mailboxes, auxiliary archive mailboxes, and component shard mailboxes.
- Collect all primary mailbox enabled recipients (may or may not have an archive enabled).
- Collect all primary mailbox enabled recipients only if an archive is enabled.
- Collect all recipients only if an archive is enabled.
- Collect all Office 365 / Unified Groups.
- Collect all guest recipients.
When the script has concluded a CSV file is generated at the path contained in the script. (This may be adjusted prior to execution.).
#Define user variables – please update as appropriate prior to running code.
[string]$outputFileName = “mailboxLocation.csv”
#Define the CSV file name.
[string]$outputFilePath = “C:\temp\”
#Define the output file path
Here is a sample entry in the csv file.
|
ExternalDirectoryObjectID |
PrimarySMTPAddress |
LocationCount |
HasPrimaryMailbox |
HasMainArchive |
HasComponentShard |
HasAuxArchive |
NumberOfAuxArchives |
RecipientType |
RecipientTypeDetails |
|
|
28cd9c67-a21a-4c49-aff1-58b5cbbebfc9 |
user@domain.com |
1 |
TRUE |
FALSE |
FALSE |
FALSE |
0 |
UserMailbox |
UserMailbox |
|
The CSV file can be opened in Excel and the columns filtered if necessary to parse information.