获取NT风格的域\用户给定的DN风格、用户、NT、DN

由网友(偷你一个亲亲)分享简介:我在Active Directory用户的DN,我想从这个NT风格的域\用户。该SAM帐户公元物业给我的用户部分,但对于域名?I have the DN of a user in Active Directory, I want to get the "NT style" domain\user from this....

我在Active Directory用户的DN,我想从这个NT风格的域用户。该SAM帐户公元物业给我的用户部分,但对于域名?

I have the DN of a user in Active Directory, I want to get the "NT style" domainuser from this. The sAMAccountname AD property gives me the user part, but what about the domain?

感谢

推荐答案

您可以通过利用用户的最后一部分DN( DC =域,DC =本地),并加入 CN =分区,CN =配置,之前。

You can get it by taking the last part of the user DN (DC=domain,DC=local) and adding CN=Partitions,CN=Configuration, before.

然后做一个子树搜索(及(NCNAME =DC =域,DC =本地)(NETBIOSNAME = *)) CN =分区,CN =配置,DC =域,DC =本地为出发点;你回来的条目将在域的NetBIOS名称 NETBIOSNAME -attribute。

Then do a subtree search for (&(nCName="DC=domain,DC=local")(nETBIOSName=*)) with CN=Partitions, CN=Configuration, DC=domain, DC=local as the starting point; the entry you get back will have the NETBIOS name of the domain in the nETBIOSName-attribute.