Convert ObjectGUID (on-premise object) to ImmutableID (in cloud object).
Script
Clear-Host
$UserSamAccount = Read-Host "Provide SamAccountName of a user"
$User = Get-ADuser $UserSamAccount -Properties ObjectGUID
$ImmutableID = [system.convert]::ToBase64String(([GUID]($User.ObjectGUID)).tobytearray())
Write-Host "ImmutableID for user $UserSamAccount is:" -ForegroundColor Cyan
$ImmutableID
4 comments
Vish Parekh
This is awesome! Thank you.
Ness
You are my hero for this script. Thank you
loukas bakatselos
Just wanted to say thanks for this script mate 🙂
PowerAddict
You’re welcome 🙂