我怎样才能获得域名\用户从AD的DirectoryEntry? [英] How can I get DOMAIN\USER from an AD DirectoryEntry?

查看:107
本文介绍了我怎样才能获得域名\用户从AD的DirectoryEntry?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取Windows用户和域从Active Directory的DirectoryEntry(SchemaClassName =用户)的对象?

How can I get the Windows user and domain from an Active Directory DirectoryEntry (SchemaClassName="user") object?

用户名是在sAMAccountName赋属性,但我在哪里可以查找域名?

The user name is in the sAMAccountName property but where can I look up the domain name?

(我不能假设一个固定的域名,因为用户从不同的子域。)

(I can't assume a fixed domain name because the users are from various subdomains.)

推荐答案

我发现了一个分区容器CN =分区,CN =配置,其中包含的所有域。

I found a partitions container in CN=Partitions,CN=Configuration that contains all domains.

在用户匹配的partion您可以从NETBIOSNAME +\+ sAMAccountName赋属性。

When you match the user to the partion you can read the real domain name from the nETBIOSName+"\"+sAMAccountName property.

这篇关于我怎样才能获得域名\用户从AD的DirectoryEntry?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆