Matching Users after migrating to new Active Directory Forest
Installing ADConnect in a new forest for the same users which have been migrated to a new Active Directory forest
In order to do so you will have to launch Azure powershell in admin mode and connect to MSOL service as in the following snapshot
$cred = get-credential
After connecting then type/copy the following
Get-MsolUser -ReturnDeletedUsers -All | Out-GridView
Once you type enter a GUI will come up showing you all the deleted users list, you should delete any old non-usable account that has similar attributes to the ones that you’re about to Sync from the AD to O365.
Once you’re sure about what do you want to delete you can go ahead with the following Command to delete the users
You must be sure that when you run this command, you will no longer be able to restore any deleted item or object later on.
Get-MsolUser -ReturnDeletedUsers -All | Remove-MsolUser -RemoveFromRecycleBin -Force –Verbose
Now you should run the following Script on the same open power shell in order to start the copying process.
$cred = Get-Credential
Connect-MsolService -Credential $cred
$onlineusers = Get-MsolUser -All
$adusers = Get-ADUser -Filter *
Press enter and when you want you get prompted to select an option choose 1 and enter
Note:If you would like to receive the powershell script please don’t hesitate to contact me.
After the copy is finished you can match for yourself the list of ImmutableID along with the GUID
Ldifde -f dump.txt