Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我发现这个问题是为了获取本地主机的 FQDN。我的问题是,有没有办法获得与我们在 c# 中查询的主机不在同一个域中的机器的 FQDN。
例如:在 machineA(在域 A 中)上运行一个程序来找出 machineB(在域 B 中)的 FQDN。
在 C# (.NET) 中,您可以调用
var fqdn = System.Net.Dns.GetHostEntry("host-name-goes-here").HostName
powershell几乎一样
$fqdn = [System.Net.Dns]::GetHostEntry("host-name-goes-here").HostName