Migrate to Office 365 Using the Command Line

Cutover Migrations and Staged Simple Exchange Migrations from on-premise and hosted email systems can be done by the remote PowerShell command line (Powershell to Exchange Online). The help for New-MigrationBatch claims that migrations from Hotmail are possible, but the actual commands are not working at this time.
Doing a migration via the command line is possible, and is documented below, but if you can do it via Exchange Control Panel it is considerably easier.
To migrate you need to create a migration connection string. This is done with Test-MigrationServerAvailability. Once you have this object you can use it in the migration with New-MigrationBatch.
To grant access to one user account to all mailboxes perform the following in Exchange Management Shell:

  • Get-Mailbox | Add-MailboxPermission -User domain\user -AccessRights FullAccess

To connect to Exchange Online do the following:

  1. Start the Windows Powershell
  2. $cred=Get-Credential tenant_admin@tenant.onmicrosoft.com
  3. $EOSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/PowerShell/ -Credential $Cred -Authentication Basic -AllowRedirection
  4. Import-PSSession $EOSession -AllowClobber

To perform the migration do the following:

  1. $MigrationSettings = Test-MigrationServerAvailability -Exchange -Credentials (Get-Credential) -ExchangeServer internal-exchange-fqdn -RPCProxyServer external-outlook-anywhere-fqdn
  • Enter credentials of account that has FullAccess rights to all mailboxes
  • New-MigrationBatch -Exchange -Name unique-name-for-migration  -ExchangeConnectionSettings $MigrationSettings.ConnectionSettings -MaxConcurrentMigrations 10 -TimeZone “Pacific Standard Time”
  • Start-MigrationBatch


To see the status of the migration do one of the following:

  • Get-MigrationBatch OR Get-MigrationStatus

Once the migration has completed (Get-MigrationBatch | Format-List Status shows Completed) then complete the migration to finish:

  • Complete-Migration



, , ,




3 responses to “Migrate to Office 365 Using the Command Line”

  1. Alessandro Cardoso avatar

    Hey Brian

    Are these steps up to date?
    Microsoft removed the Complete-Migration step

  2. Alessandro Cardoso avatar

    The Complete-Migration was removed by Microsoft

    Are these steps the updated ones?

  3. Brian Reid avatar

    @Alessandro – this blog is valid as of the date of publication, which was July 26th 2011.

    An update in April 2012 removed the Complete-Migration cmdlet and this is outlined in http://community.office365.com/en-us/blogs/office_365_technical_blog/archive/2012/04/04/why-administrators-don-t-see-the-complete-migration-button-in-the-e-mail-migration-tool.aspx

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.