C
CSharperBeginner
Guest
Hello everybody I have a big problem. I would like to read out my Ethernet network cards. This works if the NIC is not configured. As soon as an IP, subnet and default gatway is assigned, it shows me the same NIC twice. Please help me, I've been looking for the problem for a few hours. Now I need help from you professionals!
private void addETHName()
{
foreach (NetworkInterface ni in NetworkInterface.GetAllNetworkInterfaces())
{
if (ni.NetworkInterfaceType == NetworkInterfaceType.Ethernet &&
!ni.Description.ToLower().Contains("virtual") &&
!ni.Description.ToLower().Contains("pseudo"))// check for adapter type and its description
{
foreach (UnicastIPAddressInformation ips in ni.GetIPProperties().UnicastAddresses)
{
if (ips.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
{
nicEthlist.Add(ni.Name);
}
}
}
}
}
Continue reading...
private void addETHName()
{
foreach (NetworkInterface ni in NetworkInterface.GetAllNetworkInterfaces())
{
if (ni.NetworkInterfaceType == NetworkInterfaceType.Ethernet &&
!ni.Description.ToLower().Contains("virtual") &&
!ni.Description.ToLower().Contains("pseudo"))// check for adapter type and its description
{
foreach (UnicastIPAddressInformation ips in ni.GetIPProperties().UnicastAddresses)
{
if (ips.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
{
nicEthlist.Add(ni.Name);
}
}
}
}
}
Continue reading...