我写了一个关于 Windows 产品 ID(序列号)的 WMI 查询,但它没有返回产品 ID。这是什么原因?
ManagementObjectSearcher searcher =
new ManagementObjectSearcher("root\\CIMV2",
"SELECT * FROM Win32_OperatingSystem");
foreach (ManagementObject queryObj in searcher.Get())
{
Console.WriteLine("-----------------------------------");
Console.WriteLine("Win32_OperatingSystem instance");
Console.WriteLine("-----------------------------------");
Console.WriteLine("SerialNumber: {0}", queryObj["SerialNumber"]);
}
return Convert.ToString(searcher.ToString());