I would normally get the distinguished name of a member computer on the Active Directory network by calling:
TCHAR buff[256];
buff[0] = 0;
DWORD dwSz = SIZEOF(buff);
GetComputerObjectName(NameFullyQualifiedDN, buff, &dwSz);
But the issue happens when that member computer is currently not connected to a DC. For instance, if I take my work laptop home it will not have access to the local AD we have at work and the GetComputerObjectName
will fail. (I believe with the error code 1355 or ERROR_NO_SUCH_DOMAIN
.)
So my question is, is there any way to get the distinguished name of a member computer in that situation?
Hmm. So no one has any idea, hah?
My only wild guess would be get it off of this registry key for the GPOs:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine\Distinguished-Name
So what do you think?