Migrating users from on-prem to Office365 (onboarding) and from the cloud to on-premises (offboarding) is easier done by using the Shell. The migration batches are created from a csv file. After the batch is ready, we start the batch, which will synchronize the mailboxes to the cloud and keep them updated until they are completed. During the Hybrid Configuration Wizard process, a migration endpoint is automatically created in the cloud to the on-prem servers. If you don't have any endpoints configured, follow the guide here to create one.
As you see below the maximum concurrent job number is set to 20 by default. This is the number of mailboxes that can be transferred at the same time between the servers. Out of the twenty lines, 10 is made available for incremental syncs. That means when the batch finishes with the initial sync, it will keep the cloud mailbox copies updated periodically, until the batch is finalized.
PS C:\> Get-MigrationEndpoint | Select Identity,MaxConcurrentMigrations,MaxConcurrentIncrementalSyncs Identity MaxConcurrentMigrations MaxConcurrentIncrementalSyncs -------- ----------------------- ----------------------------- Hybrid Migration Endpoint - EWS (Default Web Site) 20 10
It is possible to complete either the whole batch, which technically switches the mailboxes over to the cloud and remove them from on-prem, or you can complete individual mailboxes at a time, see details below.
1. Create the CSV file with the list of mailboxes
First, we need a csv file that contains all of our mailboxes we intend to move. The b1.csv file should have only one column, called "EmailAddress" as shown below:
TIP: The following command is used to export the list of email addresses in the organization, you can further filter the list, or manually create it at your convenience. Just don't forget to rename the "UserPrincipalName" to "Emailaddress" in the first line of the csv file:
PS C:\temp> Get-Mailbox | Select UserPrincipalName | Export-Csv b1.csv -NoTypeInformation
2. Create Onboarding or Offboarding batches
On boarding is a simpler task, as we don't need to specify the target database where we want the mailboxes to be moved to, because the cloud manages that automatically. When offboarding, we want to tell Exchange where the mailboxes should be stored on-prem, as when we are talking about terabytes of data, we might want to distribute them evenly among multiple databases and possibly multiple servers.
# Onboarding: PS C:\temp> New-MigrationBatch -Name "B1" -SourceEndpoint "Hybrid Migration Endpoint - EWS (Default Web Site)" -CSVData ([System.IO.File]::ReadAllBytes("C:\temp\b1.csv")) -BadItemLimit 100 -LargeItemLimit 100 -TargetDeliveryDomain alwayshotcafe2020.onmicrosoft.com
# Offboarding: # Get DB guid; !!! Run this command against the on-prem Exchange server!!! PS C:\> Get-MailboxDatabase | Select Name,Guid Name Guid ---- ---- DB01 91bb184f-d452-49c4-835e-17dc47c95a49 # Create the offboarding batch in EOL: PS C:\temp> New-MigrationBatch -Name "OffBoarding1" -TargetEndpoint "Hybrid Migration Endpoint - EWS (Default Web Site)" -TargetDeliveryDomain alwayshotcafe.com -TargetDatabases "91bb184f-d452-49c4-835e-17dc47c95a49" -BadItemLimit 100 -LargeItemLimit 100 -CSVData ([System.IO.File]::ReadAllBytes("C:\temp\b1.csv"))
3. Start Batches
After creating, we start the batches. Alternatively, we might use the -AutoStart switch with the New-MigrationBatch cmdlet to automatically start the batch as soon as it's created.
PS C:\> "B1" | Start-MigrationBatch
4. Complete batches
Last step is completing the migration batches when they finished syncing. Also, if you prefer you can use the -AutoComplete switch with the New-MigrationBatch cmdlet which will automatically finish the move requests for you. Best practice though is to leave it on manual mode, so you will be able to decide when jobs are completed, simply because that has an effect on the user experience and you might want to schedule that completion out of business hours.
PS C:\> "B1" | Complete-MigrationBatch -Confirm:$false
Comments