The perfmon counter is using different NIC names compare to ipconfig/all and c# system call as you can see below (this is from ipconfig/all)
Ethernet adapter HHHH: Connection-specific DNS Suffix . : Description . . . . . . . . . . . : HP NC364T PCIe Quad Port Gigabit Server Adapter #3 Physical Address. . . . . . . . . : 00-1F-29-0D-26-59 DHCP Enabled. . . . . . . . . . . : No Autoconfiguration Enabled . . . . : Yes IPv4 Address. . . . . . . . . . . : 166.49.47.10(Preferred) Subnet Mask . . . . . . . . . . . : 255.255.255.240 Default Gateway . . . . . . . . . : NetBIOS over Tcpip. . . . . . . . : Disabled
using System.Net.NetworkInformation;
NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();
I get HP NC364T PCIe Quad Port Gigabit Server Adapter #3. Exactly the same as ipconfig.
BUT the perfmon is using HP NC364T PCIe Quad Port Gigabit Server Adapter _3 (underscore instead of hash). Do I have to use a different call to get the same exact counter name as what the perfmon has? If so, what is it?
I personally would use the registry to list the Network devices in a native way.
There are many different ways to retrieve information, but not all ways display
information like system does.
A possible code sample could look like this (not fully error handled).
It works for me on Windows Vista 32/64 bit and 7.
It’s quite a bit different from the NET class, but it think it does the same way.
The Namespace “using Microsoft.Win32” must be added to run the code.