joeware - never stop exploring... :)

Information about joeware mixed with wild and crazy opinions...

Getting the DN of the parent of an object

by @ 10:33 pm on 5/11/2017. Tags:
Filed under general, tech

Do you remember how several years ago I added to AdFind the ability to display the parent of the object you searched for? Microsoft finally added that ability as well for any LDAP query as of Windows Server 2012 R2 and ADLDS for Windows 8.1/Windows Server 2012 R2.

The attribute is called msDS-parentdistname.

[Thu 05/11/2017  22:10:46.92]
E:\>adfind -e k16 -f name=unix* msDS-parentdistname -dpdn

AdFind V01.50.00cpp Joe Richards (support@joeware.net) May 2017

Using server: K16TST-DC1.k16tst.test.loc:389
Directory: Windows Server 2016
Base DN: DC=k16tst,DC=test,DC=loc

dn:OU=Unix,OU=TestOU,DC=k16tst,DC=test,DC=loc
>parentdn: OU=TestOU,DC=k16tst,DC=test,DC=loc
>msDS-parentdistname: OU=TestOU,DC=k16tst,DC=test,DC=loc

dn:CN=UnixCN,CN=TestContainer,DC=k16tst,DC=test,DC=loc
>parentdn: CN=TestContainer,DC=k16tst,DC=test,DC=loc
>msDS-parentdistname: CN=TestContainer,DC=k16tst,DC=test,DC=loc

dn:CN=unixCNgroup,CN=UnixCN,CN=TestContainer,DC=k16tst,DC=test,DC=loc
>parentdn: CN=UnixCN,CN=TestContainer,DC=k16tst,DC=test,DC=loc
>msDS-parentdistname: CN=UnixCN,CN=TestContainer,DC=k16tst,DC=test,DC=loc

dn:CN=unixgroup,OU=Unix,OU=TestOU,DC=k16tst,DC=test,DC=loc
>parentdn: OU=Unix,OU=TestOU,DC=k16tst,DC=test,DC=loc
>msDS-parentdistname: OU=Unix,OU=TestOU,DC=k16tst,DC=test,DC=loc

dn:CN=unixgroup2,OU=Unix,OU=TestOU,DC=k16tst,DC=test,DC=loc
>parentdn: OU=Unix,OU=TestOU,DC=k16tst,DC=test,DC=loc
>msDS-parentdistname: OU=Unix,OU=TestOU,DC=k16tst,DC=test,DC=loc

5 Objects returned

Now I could change AdFind to just use that attribute but since I know for a fact people who are using AdFind for earlier Windows versions and for non-Microsoft LDAP implementations it will stay right where it is.

     joe

Rating 4.33 out of 5

Leave a Reply

Please note: Comment moderation is currently enabled so there will be a delay between when you post your comment and when it shows up. Patience is a virtue; there is no need to re-submit your comment.

[joeware – never stop exploring… :) is proudly powered by WordPress.]