Using MigrationWiz for Google Resources, Bulk Edition


Tonight, while working with another consultant, we ran into a migration challenge–how to migrate Google resources and calendars to Office 365 shared mailboxes.

If you only have to do one or two, the guidance at BitTitan’s support site works well. An overview:

  • Add the resource calendar to an admin account in Google Apps.
  • Grant MigrationWiz API access to the Google Account.
  • In the MigrationWiz portal, configure a Google Apps to Office 365 Migration Project.
  • In the project’s Advanced Options, under Support Options, configure a Recipient Map.
  • Add a mailbox to the project where the source email address is an admin in the Google Apps environment and the target is a Global Admin that has the Impersonation right granted.
  • Edit the mailbox.
  • Under Folder Filter, enter a RegEx to identify the Calendar folder.
  • Under Support Options, configure a FolderMapping entry.

What happens if you have dozens (or in my case, hundreds of them)?  Fortunately, MigrationWiz has a PowerShell interface.  To use the cmdlets, you will need API access granted on your MigrationWiz account and the MigrationWiz PowerShell module.

For my project, I created a CSV with the following data:

GoogleAppsDisplayName,GoogleAppsResourceEmail,Office365ResourceEmail
Team Calendar,contoso.com_3942ad39450293458257906.resource.calendar.google.com,TeamCalendar@contoso.com

After you have met the prerequisites, you can launch the MigrationWiz Command Shell and execute this script:

<#
.SYNOPSIS
Automate creation of MigrationWiz connector for Google Resources.

.PARAMETER ConnectorName
Name of new connect to create in the MigrationWiz portal.

.PARAMETER Credential
MigrationWiz portal credential.

.PARAMETER InputFile
CSV file with columns:
GoogleAppsDisplayName,GoogleAppsResourceEmail,Office365ResourceEmail

.PARAMETER ZoneRequirement
MWiz Datacenter for connector.
.PARAMETER GoogleAdminEmailAddress
Email address of the Google Apps Administrator account.

.LINK
https://gallery.technet.microsoft.com/MigrationWiz-Google-013a5832

.NOTES
THIS CODE AND ANY ASSOCIATED INFORMATION ARE PROVIDED “AS IS” WITHOUT WARRANTY 
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 
IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK OF USE, INABILITY TO USE, OR RESULTS FROM THE USE OF 
THIS CODE REMAINS WITH THE USER.

Author: Aaron Guilmette
        aaron.guilmette@microsoft.com
#>

param(
    [Parameter(Mandatory=$True,HelpMessage="New Mailbox Connector Name")] 
        [string]$ConnectorName,
    
    [Parameter(Mandatory=$True,HelpMessage="Input file")]
        [string]$InputFile,
    
    [Parameter(Mandatory=$True,HelpMessage="Administrator email address for Google Apps tenant")]
        [string]$GoogleAdminEmailAddress,

    [Parameter(Mandatory=$False,HelpMessage="MigrationWiz Zone")]
        [ValidateSet("Any","NorthAmerica","AsiaPacific","WesternEurope","Australia","Japan","SouthAmerica")]   
        [string]$ZoneRequirement = "NorthAmerica",
    
    [Parameter(Mandatory=$True,HelpMessage="MigrationWiz Logon Credential")]
        [System.Management.Automation.CredentialAttribute()]$Credential 
    )

# Obtain the MigrationWiz Ticket
$Ticket = Get-MW_Ticket -Credential $Credential

# Import the mailbox list
$data = Import-Csv $InputFile

# Build the RecipientMapping= lines for Support Options
$ConnectorAdvancedOptions = ""
Foreach ($Mailbox in $data)
    {
    $ConnectorAdvancedOptions += "RecipientMapping=""$($Mailbox.GoogleAppsResourceEmail)->$($Mailbox.O365UPN)"""
    $ConnectorAdvancedOptions += " "
    }
$ConnectorAdvancedOptions += "MigrateGmailAllCalendar=1"

# Create the Mailbox Connector
Add-MW_MailboxConnector -Ticket $Ticket `
    -Name $ConnectorName `
    -AdvancedOptions $ConnectorAdvancedOptions `
    -ProjectType Mailbox `
    -DisabledMailboxItemTypes "Contact, Mail" `
    -ExportType Gmail `
    -ImportType ExchangeOnline2 `
    -UserId $Ticket.UserId `
    -MaximumDataTransferRate 9223372036854775807 `
    -MaximumDataTransferRateDuration 600000 `
    -MaximumSimultaneousMigrations 100 `
    -PurgePeriod 180 `
    -ZoneRequirement $ZoneRequirement
# Obtain the Connector ID of the connector that was just created; the ConnectorId
# is needed to associate the mailbox with the connector.
$ConnectorId = (Get-MW_MailboxConnector -Ticket $Ticket | ? { $_.Name -eq $ConnectorName }).Id.ToString()
Foreach ($mailbox in $data)
{
$FolderRegEx = $($mailbox.GoogleAppsDisplayName).Replace("\","\\").Replace(".","\.").Replace("^","\^").Replace("$","\$").Replace("*","\*").Replace("+","\+").Replace("-","\-").Replace("?","\?").Replace("(","\(").Replace(")","\)").Replace("[","\[").Replace("]","\]").Replace("{","\{").Replace("}","\}").Replace("|","\|")
$MailboxAdvancedOptions = "FolderMapping=""Calendar/$($FolderRegEx)->Calendar"""
$FolderFilter = "^(?!Calendar/"+$FolderRegEx+")"

#Write-Host MaiboxAdvancedOptions is $MailboxAdvancedOptions
#Write-Host FolderFilter is $FolderFilter

Write-Host -NoNewLine "Adding "
Write-Host -NoNewLine -ForegroundColor Green "$($mailbox.GoogleAppsResourceEmail) "
Write-Host "to $($ConnectorName) with Id of $($ConnectorId)."

Add-MW_Mailbox -Ticket $Ticket `
-ConnectorId $ConnectorId `
-ExportEmailAddress $GoogleAdminEmailAddress `
-ImportEmailAddress $mailbox.Office365ResourceEmail `
-AdvancedOptions $MailboxAdvancedOptions `
-FolderFilter $FolderFilter
}

After the script has built the connectors and mailboxes, log into the MigrationWiz portal and add/update the credentials for the project (GMail as the source and Office 365 as the destination):

  1. Select Mailbox Migration.
    1
  2. Click pencil icon (Edit) for the name of the Connector/Project you specified in the -ConnectorName parameter
    2c
  3. Click New.
    3
  4. Fill out the form, specifying the domain and company name, and then click Save.
    4
  5. Select Source Settings in the navigation pane, and then click New.
    5
     
  6. Add the information for the Gmail Endpoint and click Add Endpoint.
    6
  7. Select Destination Settings in the navigation pane, and then click New.
    7
  8. Add the information for the Office 365 endpoint and click Add Endpoint.
    8
     
  9. Click Save Project.
    9

10. Select the connector, click the checkbox above the mailboxes to select all mailboxes, and then click Play to start the migration.

You can also go to the TechNet Gallery and download the script to configure the connector and mailboxes.  You’ll still have to modify the credential objects. 🙂 Once you’ve done this, you might want to head over to my next Google Migration Post.

Comments (0)

Skip to main content