How to get nic card name
c#, ethernet, nic, windows-server-2008-r2
Solution
Something like this?
public static void ShowInterfaceSummary()
{
NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface adapter in interfaces)
{
Console.WriteLine ("Name: {0}", adapter.Name);
Console.WriteLine(adapter.Description);
Console.WriteLine(String.Empty.PadLeft(adapter.Description.Length,'='));
Console.WriteLine(" Interface type .......................... : {0}", adapter.NetworkInterfaceType);
Console.WriteLine(" Operational status ...................... : {0}",
adapter.OperationalStatus);
string versions ="";
// Create a display string for the supported IP versions.
if (adapter.Supports(NetworkInterfaceComponent.IPv4))
{
versions = "IPv4";
}
if (adapter.Supports(NetworkInterfaceComponent.IPv6))
{
if (versions.Length > 0)
{
versions += " ";
}
versions += "IPv6";
}
Console.WriteLine(" IP version .............................. : {0}", versions);
Console.WriteLine();
}
Console.WriteLine();
}
Problem
Anybody knows how to get nic card name when I do ipconfig/all I can get this ``` Ethernet adapter XC99HT: Connection-specific DNS Suffix . : xx.xx.com Description . . . . . . . . . . . : HP NC382i DP Multifunction Gigabit Server Adapter Physical Address. . . . . . . . . : F4-CE-46-94-E8-B0 DHCP Enabled. . . . . . . . . . . : No Autoconfiguration Enabled . . . . : Yes IPv4 Address. . . . . . . . . . . : 177.77.153.48(Preferred) Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 177.77.153.1 DNS Servers . . . . . . . . . . . : 177.77.124.129 177.77.124.130 Primary WINS Server . . . . . . . : 177.77.124.129 Secondary WINS Server . . . . . . : 177.77.124.130 NetBIOS over Tcpip. . . . . . . . : Enabled ``` would like to get "HP NC382i DP Multifunction Gigabit Server Adapter" just by using/passing the Ethernet name "XC99HT"