Odrai
Odrai

Reputation: 2353

Retrieve unique device ID

What is the most unique ID of a device and how to retrieve it with a ManagementObjectCollection in C#?

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

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

Thank you in advance!

Upvotes: 0

Views: 256

Answers (1)

Dunken
Dunken

Reputation: 8681

Just take the "DeviceID"-property from your ManagementObject.

Upvotes: 1

Related Questions