添加System.Management的引用,
using System.Management;
string mac = ""; ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration"); ManagementObjectCollection moc=mc.GetInstances(); foreach(ManagementObject mo in moc) { if ((bool)mo["IPEnabled"]) { mac = mo["MacAddress"].ToString(); } }