Reuse DirSync in a new server after removing DirSync or in case DirSync server has crashed or no longer working.

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

clip_image001[5]

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.

clip_image002[4]

Once you’re sure about what do you want to delete you can go ahead with the following Command to delete the users

Note:
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

clip_image003[4]

Now you should run the following Script on the same open powershell in order to start the copying process.

Import-Module Msonline
Import-Module ActiveDirectory
$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

clip_image004[4]
<<immutableİDmatch.ps1>>

After the copy is finished you can match for yourself the list of ImmutableID along with the GUID
Ldifde -f dump.txt

Dump.txt

clip_image005[4]

clip_image006[4]

Hope you find this useful coz I did Winking smile 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.