如何使用 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/