用于检测 Windows Active Directory 名称/IP 的 API

发布于 2024-11-29 09:35:42 字数 217 浏览 0 评论 0原文

我需要在 Windows 中检测本地和 Active Directory(如果存在)中的所有用户。

我发现 C API:NetQueryDisplayInformation() 还可以选择从“serverName”检索信息,该服务器可能是可以查询的 Active Directory。

但是我如何知道 ActiveDirectory 是否可用/及其名称? 谢谢。

I have a requirement to detect all users from local and Active Directory(if present) in Windows.

I have found that C API: NetQueryDisplayInformation() has also the option to retrieve the information from a "serverName", which is presumably an Active Directory which can be queried.

But how do I find out if ActiveDirectory is available/ and it's name ?
Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

淡莣 2024-12-06 09:35:42

此信息可在 WMI 中找到。在 Win32_ComputerSystem 类(每台计算机只有一个实例)有一个包含域名的 Domain 属性。

This information is available in WMI. In the Win32_ComputerSystem class (there will be a single instance per computer) has a Domain property containing the domain's name.

離人涙 2024-12-06 09:35:42

查找域名(如果存在)的另一种方法是使用 WIN API ::DsGetDcName()
该函数返回 DOMAIN_CONTROLLER_INFO 结构中有关 Active Dir 服务器名称的信息。
您可以在那里获得所需的所有域名信息。比使用 WMI 简单得多:-)

Another way of finding out domain name (if present) is to use WIN API ::DsGetDcName()
This one returns information about Active Dir server name in DOMAIN_CONTROLLER_INFO struct.
You get there all the domain information you need. Much sympler than using WMI :-)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文