我的计算机在域(Active Directory)中,我需要动态获取域名。我在互联网上找到了以下代码:
SelectQuery query = new SelectQuery("Win32_ComputerSystem");
using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(query))
{
foreach (ManagementObject mo in searcher.Get())
{
if ((bool)mo["partofdomain&