There has been a number of times I have had a call where a customer wanted to Migrate users from a non HMC
environment into an Exchange 2010 Sp1 or Sp2 Hosting Environment.  We do have documentation for how to move
users from HMC environments to 2010 hosting, but there seem to be either confusion over how do we migrate
users from Non HMC environments or we don't have good documentation on how to accomplish this.

So recently I had a customer who wanted to move users from an Exchange 2010 server into an Exchange 2010 SP2
hosting Tenant. Let's say they wanted to move users from Source Forest  into a Tenant called on the Target Forest. They were having difficulty getting the Prepare-MoveRequestHosting script
to work correctly.  Also note that Prepare-MoveRequest script is not meant for this purpose as it won't populate
some important attribute on the Migrated Target user.  So the Prepare-MoveRequestHosting script is the right script
to be used.

There are two important User attributes that needs to be populated before you can move the mailbox from Source
 Forest inot the Target forest. These attributes are the following ..

MsExchCU :     CN=Configuration,,CN=ConfigurationUnits,CN=Microsoft Exchange,CN=Services,

MsExchUserRoot :,OU=Microsoft Exchange Hosted Organizations,DC=Hosted,DC=lab

The DN for both will be the same for all of you out there, except the Tenant name and the main root domain which
in my case are and hosted.lab respectively.  So if you are writing your own script to take care of
this, these are the attributes you need to correctly populate.

msExchUserAccountControl should also be populated and again this is if you are writing your own scripts or using
LDIFDE tool to export your users on the Source Forest and Import them on the Target Forest.  An Example of using
LDIFDE tool would be like following

ldifde -f exportuser.ldf -s fineart-dc -d "CN=Users,DC=fineartschool,DC=net" -p subtree -r "(&(objectCategory=person)
(objectClass=User)(givenname=*))" -l "displayname,mail,mailnickname,msExchMailboxGuid,proxyaddresses,

The above command will export your users on the Source forest and put them all into an LDF file.  You can specify
what attributes you want exported as you can see above, the most important one is the msExchMailboxGuid in this
case. Then you can import these users into your Target Forest using the following command, but before you do you
willhave to write a script to update your LDF file adding the other required attributes such as msExchCU,
msExchUserRoot and msExchUserAccountControl etc .  

ldifde -i -f exportuser.ldf -s hosted-dc

But you are not scripting your way into this and you won't be using the LDIFDE tool, because you just want the
PowerShell scripts that comes with Exchange to work for you, so here is how you need to accomplish this and keep
in mind that Prepare-MoveRequestHosting script will take care o
f populating the right attributes for you so you
don’t have to worry about those.  You just need to pass two of the important parameters to the script.

Let's say you want to move a user called  Robert Smith from the Source Forest into the Target Forest with SMTP address First you need to run the following command on in the Target Exchange Hosting Server

New-Mailuser  -Organaization   -ExternalEmailAddress:  -Name “Robert Smith”

Once this is done, you are ready to run your Prepare-MoveRequestHosting  Script. Run the following command

[PS] C:\Program Files\Microsoft\Exchange Server\V14\scripts>.\Prepare-MoveRequestHosting.ps1 -Identity
Roberts  -RemoteForestDomainController -RemoteForestCredential
(Get-Credential fineartschool\administrator)  -LocalForestDomainController Hosted-dc.hosted.lab
-LocalForestCredential (Get-Credential hosted\administrator) -UseLocalObject  -TargetExternalSmtpAddress
-TargetMailUserOU ",OU=Microsoft Exchange Hosted Organizations
 -TargetMailUserCU "CN=Configuration,,CN=ConfigurationUnits,CN=Microsoft

Note the two parameters above TargetMailUserOU and TargetMailUserCU, these are the previous AD attributes I
mentioned before msExchUserRoot and MsExchCU.

When you run the above command you should get the following response

Appending x500:/o=FINEARTSCHOOL/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients
/cn=Robert Smith0a1 to proxyAddresses of Object(CN=Robert Smith,,OU=Microsoft Exchange
Hosted Organizations,DC=Hosted,DC=lab) in Local forest. Appending x500:/o=HOSTED/ou=Exchange Administrative
Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=Robert Smithdd1 to proxyAddresses of Object(CN=Robert Smith,
CN=Users,DC=fineartschool,DC=net) in Source forest.
Preparation for done. Local recipient info Merged.
1 mailbox(s) ready to move.

Now you are ready to move the Mailbox from your Source Forest Exchange server into your Target Forest Exchange
Hosting server  by running the following command

[PS] C:\Program Files\Microsoft\Exchange Server\V14\scripts>New-MoveRequest -Identity
-TargetDatabase "Mailbox Database 1658210873" -RemoteGlobalCatalog "" -Remote
-RemoteHostName "" -RemoteCredential(Get-Credential fineartschool\administrator)
-TargetDeliveryDomain ""

DisplayName               Status                    TotalMailboxSize          TotalArchiveSize         PercentComplete
-----------               ------                    ----------------          ----------------         ---------------
Robert Smith            Queued                    2.083 MB (2,184,646 by...                          0

If you were to move users from a Source Forest with Exchange 2003 server, things would be a bit different. For example
no MRSProxy here to enable or your New-MoveRequest Command would have to also include -RemoteLegacy parameter.

There are a number of things you need to take care of before all of this is possible such as enabling MRSProxy on the
Source CAS server you are connecting to and making sure the Certificate on the Source CAS server can be trusted
or verified online if it's a third party Certificate, but I am assuming you took care of all that already and those are
beyond the scope of this article.

There may also be a lot of errors that you may get when running these scripts and commands depending on the
parameters you pass on to them or other things you may not have taken care of.  Give us a call if you are running
into such issues.

- Farshad Taghavi