Once you have completed migrating a user or users to Office 365 via a Staged Migration you’ll need to change their objects in Active Directory to Mail Enabled objects.

This process will disable their email mailbox on Exchange 2007 and then create a contact within Active Directory.  The contact will contain their old email address and will point to their Office 365 “onmicrosoft.com” address.

There are two pre-supplied scripts from Microsoft which work great for this task supplied here.

But there are a few things you might stumble across that are EASY to fix but you might stare at them and say “Huh?”

The first (And most important) is running the .ExportO365UserInfo.PS1 script which pulls down the GUIDS and details needed to properly create the Mailenabled objects.

Initially I could get it to run but of course I didn’t do a basic “Read The FinelyPrinted Manual” on where the source file is.  The source file is of course the CSV file you uploaded to Office 365 with the list of users to migrate.  Nothing more than that.

So if my list of users was in ‘userstomigrate.csv’ I would launch the script in the following manner

.ExportO365UserInfo.PS1 –migrationCSVFilename userstomigrate.csv

Ah but you MIGHT find it doesn’t work on your Exchange server.  This makes sense as the script uses Implicit Remoting to connect to Office 365.   However the data files you need don’t need to be on the server (as it’s just your CSV upload file)

The other challenge you encounter is when running the script is if you already have an active Office 365 session and you try to use it.  You may get this error.

image

This is actually pretty easy to fix.   The problem is that the Script is built presuming you have a prefix called “Cloud” on your Office 365 Cmdlets so you have two options.

One you edit the line in the script to just use Get-Mailbox instead of Get-CloudMailbox.  I believe it’s down about Line 37 on the current release.

BEFORE

image

 

AFTER

image

 

Or if you like you can create your own module with the following script below (which will also speed things up tremendously on the load time if you’re doing a lot of these migrations in batches)

$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Export-PSSession $Session -modulename Office365

This will create a module simply called Office 365.  You can access it and create it with a “Cloud” prefix in the following manner

Import-Module Office365 –prefix Cloud

Then you can have the ExportO365UserInfo.PS1 script use your existing session with the script unchanged.

From that point on just take the supplied data file created by the script, run it on your Exchange 2007 server (or your Management Console with the Exchange 2007 Cmdlets) and let PowerShell do all the rest of the work for you.

Cheers!

Sean
The Energized Tech