I wanted to read the otherWellKnownObjects attribute from an Active Directory object.

In my case this was the Microsoft Exchange container in the Configuration partition:

image

The otherWellKnownObjects attribute is of type ADSTYPE_DN_WITH_BINARY which unfortunately cannot be viewed or edited with ADSI Edit:

There is no editor registered to handle this attribute type 

 

So I wrote a script to read the values with PowerShell but it’s not very straightforward how to do this.

Reading the otherWellKnownObjects property returns a collection of IADsDNWithBinary interfaces but this interface is unknown in PowerShell.

Using reflection we can read the values: