Given a device instance ID for a network card, I would like to know its MAC address. Example device instance ID on my system for integrated Intel Gigabit card:
Here's one way to do it:
AdapterName
field (I'm not sure if this behaviour is guaranteed, but all the adapters in my system have a GUID here, and the documentation says the AdapterName
is permanent)HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\\Connection\PnPInstanceID
(if it exists) (got this idea from here; searching on Google that key seems to be well documented, so it's not likely to change)PCI\VEN_14E4&DEV_16B1&SUBSYS_96B11849&REV_10\4&2B8260C3&0&00E4
)IP_ADAPTER_ADDRESSES
and look at the PhysicalAddress
fieldIt wouldn't be Windows if there weren't a million ways to do something!