获取网卡信息

 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();

posted @ 2014-09-18 14:25  ChineseMoonGod  阅读(138)  评论(0编辑  收藏  举报