Get MAC Address when network adapter is disabled?

It is not possible to get the MAC address of an adapter which is disabled: this is because getting the MAC address requires querying the driver, and the driver for a disabled adapter is not loaded (source).

You can, however get the MAC address of an adapter which is not currently connected.

The WMI route is no good here, because it shows the MAC address as null for adapters which are not connected. The good news is that the NetworkInterface.GetAllNetworkInterfaces() route works just fine:

// using System.Net.NetworkInformation;
var nics = NetworkInterface.GetAllNetworkInterfaces();

// pick your NIC!
var selectedNic = nics.First();

var macAddress = selectedNic.GetPhysicalAddress().ToString();

Refer this link.

http://msdn.microsoft.com/en-us/library/system.net.networkinformation.physicaladdress.aspx

The example here displays physical address of all interface irrespective of their operational stage. HTH.

Tags:

C#

Vb.Net