Another week of AD Object GUID fun! I’ve created an abridged version of a previous post, so crack open your extreme cola of choice for some extreme PowerShell of choice…
Let’s ask for the ParentGuid (the clue’s in the name) constructed attribute of an AD object. How about an OU?
$Ou = Get-ADOrganizationalUnit -Identity "OU=Word Smiths,OU=User Accounts,DC=HALO,DC=NET" -Properties ParentGuid $Ou.ParentGuid
Hmmm, doesn’t look like any GUID I’ve ever seen. Probably a byte array or something. Time for the extreme fun! Hold on tight…
What a thrilling bit of conversion using the [GUID] type accelerator!
Now let’s grab the parent object.
Get-ADObject -Identity ([GUID]$Ou.ParentGuid).Guid