C#获取MAC
public static List<string> GetMacByWMI() { List<string> macs =new List<string>(); try { 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(); macs.Add(mac); } } moc =null; mc =null; } catch { } return macs; }