gpt4 book ai didi

c# - 如何获取域 Controller IP地址

转载 作者:行者123 更新时间:2023-11-30 19:35:05 25 4
gpt4 key购买 nike

如何使用 C# 以编程方式获取域 Controller IP 地址?

最佳答案

下面是我的做法。

您需要使用 System.Net 和 System.DirectoryServices。

// get root of the directory data tree on a directory server
DirectoryEntry dirEntry = new DirectoryEntry("LDAP://rootDSE");
// get the hostname of the directory server of your root (I'm assuming that's what you want)
string dnsHostname = dirEntry.Properties["dnsHostname"].Value.ToString();
IPAddress[] ipAddresses = Dns.GetHostAddresses(dnsHostname);

关于c# - 如何获取域 Controller IP地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/492391/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com