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”

Leave a Reply

Your email address will not be published.

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