Office 365 Mailbox Migration Planning Script

Every user mailbox in Exchange Online requires an Office 365 license to be assigned to the user.  Often when migrating from Exchange On-premises, there are more user mailboxes than actual users, and more importantly, more user mailboxes than Office 365 licenses.  In this scenario, a number of options can be considered including:

  1. Migrate user mailbox (requires an Office 365 license)
  2. Decommission user mailbox (redundant)
  3. Convert user mailbox to shared mailbox and migrate (no Office 365 license required)

The following script combines the output from Get-Mailbox and Get-MailboxStatistics against all mailboxes into a CSV file to help make a more informed decision about what to do with the excess of mailboxes in an on-premises environment.  Information captured includes:

  1. Display Name
  2. Primary SMTP Address
  3. Account Disabled
  4. Is Mailbox Enabled
  5. Is Shared
  6. Is Resource
  7. Is root Public Folder Mailbox
  8. Organization Unit
  9. Last Logon Time
  10. Total Item Size

You can download the script from the Technet Gallery here


Run the script from the Exchange Management Shell (EMS).  Once complete, I usually convert the CSV to an Excel file as follows so I can filter on the different attributes / fields

  1. Open the CSV file using Microsoft Excel
  2. Highlight / select all the rows and columns with data, select the “Insert” Tab, click on “Table”


3. Make sure to tick “My table has headers”, the click OK


4. Now you have an excel spreadsheet, in table format with filters, with detailed information about all your mailboxes


Leave a Reply

Your email address will not be published. Required fields are marked *