convert DirXML-Associations of Active Directory driver to ObjectGuid

Hi

I'm reading eDirectory values from a PowerShell script. A IDM user's Active Directory account information is not fully stored in eDir so sometimes I need to grab some other information of that user from Active Directory.

But to be able to lookup that info I need to convert the objectGuid from the DirXML-Associations which is stored like this "cn=A01_SomeAD_Driver,cn=driverset1,o=system#1#bd2939d2f7d8114475a0bcd5f535e61b"

Decoding the last part where the objectGUID is stored as "bd2939d2f7d8114475a0bcd5f535e61b" seems to be impossible. Our integrator told me that it was stored in base64 format but when trying online decoding tools to convert from base64 I dont get the correct conversion.

What's the right way to get the correct value from this string?

  • Verified Answer

    +1  

    Specifically with PowerShell, I have long used the following one line expressions to convert between the two formats. Just paste in your GUID or assoc and run the command. It will spit out the other representation.

    GUIDToAssoc

    [System.BitConverter]::ToString([System.GUID]::Parse('{D23929BD-D8F7-4411-75A0-BCD5F535E61B}').ToByteArray()).toLower() -replace '-'

     

    AssocToGUID

    ([system.guid][byte[]]('bd2939d2f7d8114475a0bcd5f535e61b' -split '(..)' | ?{ $_} | %{[System.Convert]::ToByte($_,16)})).ToString().toUpper()

    Technically, I believe Microsoft refers to the Assoc format as a "Packed GUID".

    You can find complex descriptions of how to visually convert between Original GUID and packed GUID. These are generally not necesary.

    However, it is just an alternate (and slightly more compact) string representation of the byte array that is used internally to represent a GUID in the operating system. I believe it started being used when the Windows registry was first introduced as it offered a more efficient way to store, sort and visually represent GUIDs within registry entries.

    Note: In the windows application deployment world, there is another concept called "Compressed GUID" which is even shorter at 23 characters long. That is something completely different. It came much later and is not really used anywhere outside of application packaging to my knowledge..

  • 0 in reply to   

    You my friend, are a HERO!

    Thank you!