How to find Active Directory container from registry

staudk27 picture staudk27 · May 17, 2013 · Viewed 8.5k times · Source

I am looking for a way to retrieve a computers Active Directory container from the registry stored on that same machine. Is there any registry key in Windows that would contain the full LDAP path for the computer object?

Ex. Computers\MyDomain.local

Answer

Matt picture Matt · Mar 31, 2016

It should be located in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine, string value called "Distinguished-Name"

I think this will be the location as of the last successful group policy refresh.