Hello nki00,
On 1/25/2012 2:01 AM, nki00 wrote:
> I need to find out the name of the OU that the local computer (that is
> connected to the Active Directory) belongs to using WinAPI/C++. Any ideas?
>
>
I would assume that you could just append the $ to the computer name and
lookup its computer SID (so you look up the SID of the computer account
in AD). Then, assuming it is a Windows Server 2003 domain, you can look
up the object using an LDAP query of the form
LDAP://servername/<SID=XXXXX> or with serverless binding such as this:
LDAP://<SID=XXXXX>. You should then be able to query the
distinguishedName attribute of this object which contains the OUs of the
computer object in AD (remember: you can have nested OUs).
--
S