Get Network card description and Mac address from Win32_NetworkAdapterConfiguration : Win32_NetworkAdapterConfiguration « Network « C# / CSharp Tutorial






using System;
using System.Management;

class MainClass
{
    public static void Main()
    {
        ManagementObjectSearcher query = new ManagementObjectSearcher("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'TRUE'") ;
        ManagementObjectCollection queryCollection = query.Get();
        foreach( ManagementObject mo in queryCollection )
        {
            Console.WriteLine("Network Card: {0}", mo["Description"]);
            Console.WriteLine("MAC Address: {0}", mo["MACAddress"]);
        }
    }
}
Network Card: Realtek RTL8139 Family PCI Fast Ethernet NIC - Packet Scheduler Miniport
MAC Address: 00:C0:9F:C5:BD:14
Network Card: Broadcom 802.11b/g WLAN - Packet Scheduler Miniport
MAC Address: 00:14:A5:11:90:DC








33.35.Win32_NetworkAdapterConfiguration
33.35.1.Get Network card description and Mac address from Win32_NetworkAdapterConfiguration
33.35.2.Get IP address from Win32_NetworkAdapterConfiguration
33.35.3.Get subnet mask from Win32_NetworkAdapterConfiguration
33.35.4.Get default gateway from Win32_NetworkAdapterConfiguration