检索唯一的设备ID

时间:2014-03-31 13:50:50

标签: c#

设备中最独特的ID是什么以及如何使用C#中的ManagementObjectCollection检索它?

using (var searcher = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_PnPEntity"))
                collection = searcher.Get();

foreach (var valueString in from mo in collection.Cast<ManagementObject>()...

提前谢谢!

1 个答案:

答案 0 :(得分:1)

从管理对象中获取"DeviceID"-property