An odd situation occurred where I had to delete an AD user then recreate it and link it to the 365 user account.
Here are the steps.
- Take a note of the AD user details.
- Delete AD user
- Run ADSync
- The 365 user will have been deleted, un-delete the user on the 365 side.
- Create a new AD user with the same properties as the old one.
- In PowerShell: Connect-MsolService
- In PowerShell: get-MsolUser -UserPrincipalName user@example.com | select ImmutableID
- Copy the ID given and keep just in case.
- On the AD server: make and run a PowerShell script with the following text
$Users=Get-ADUser -Filter *
function guidtobase64{param($str);$g = new-object -TypeName System.Guid -ArgumentList $str;$b64 = [System.Convert]::ToBase64String($g.ToByteArray());return $b64;}$ADUsersDump=$Users | Select SamAccountName,UserPrincipalName,@{Expression={(guidtobase64($_.ObjectGUID))}; Label="ImmutableID"}$ADUsersDump | Export-CSV -Path C:\temp\ImmutableIDs.csv
- In PowerShell: set-MsolUser -UserPrincipalName user@example.com -ImmutableId ""
- In PowerShell: Set-MsolUser -UserPrincipalName user@example.com -ImmutableId <ImmutableID from script output>
- Run ADSync
No comments:
Post a Comment