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
6 comments
Don
Thanks man!
PowerAddict
You’re welcome 🙂
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 🙂