One of the scripts to help you convert on-premises mailboxes to mail-enabled users is a Windows PowerShell script named ExportO365UserInfo.ps1 ...

One of the scripts to help you convert on-premises mailboxes to mail-enabled users is a Windows PowerShell script named ExportO365UserInfo.ps1 that you run in your %BRAND_OFFICE_365_SHORT% organization to collect information about the cloud mailboxes. This script requires a CSV input file that lists the primary SMTP address for all cloud mailboxes. Perform the following steps in your %BRAND_OFFICE_365_SHORT% organization to create this CSV file: