PowerAddict.net

powerAddict.NET

by Lou Goban
IT Application Professional at Syntax

Get Immutable ID of AD object

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

Leave your comment