I hope you can help and I apologize right off the bat if this has been answered before but I cannot find any info.
I want to export a list of users from on-prem AD and convert their ObjectGUID to and Immutable ID. (This I have accomplished)
I then want to take that exported info and use it so set the Immutable ID for each of the users's O365 accounts in preparation for Azure integration. I want to do this so I can enforce a hard match to avoid duplicate accounts etc.
Below is the code I have thus far and basically need help in completing it using for loops etc. (I am guessing)
Import-Module ActiveDirectory
$Users=Get-ADUser -Filter *
function guidtobase64
{
param($str);
$g = new-object -TypeName System.Guid -ArgumentList $str;
$b64 = [System.Convert]::ToBase64String($g.ToByteArray());
return $b64;
}
$Users | Select UserPrincipalName,@{Expression={(guidtobase64($_.ObjectGUID))}; Label="ImmutableID"} | Export-Csv c:\AzureSync_ProcessingOps.csv -Delimiter ';' -NoTypeInformation