首页 > 代码库 > 获取网卡信息

获取网卡信息

 ManagementClass mc;
            mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
            ManagementObjectCollection moc = mc.GetInstances();
            foreach (ManagementObject mo in moc)
            {
                //if (mo["IPEnabled"].ToString() == "True")
                //    Console.WriteLine( mo["MacAddress"].ToString());

                  if (mo["IPEnabled"].ToString() == "True")
                    Console.WriteLine(mo["MacAddress"].ToString());
            }


            Console.Read();

获取网卡信息