Identify Physical Port in Multiple Ports Network Adapter on Windows Servers with PowerShell
I think most of the Server Administrators might struggling with finding which network connections in the Windows are belonged to which physical ports at the back of server. For somehow not all the datacenter in the world might not be equipped with proper labelling. Even Microsoft doesn't care about naming network connections and interface descriptions in its OS GUI. We can't say the naming mythology of Microsoft in Device Manager are correctly named and matched with physical network ports in order. Nowadays servers shipped with at least 4-port NIC at the back. All ports on NIC has label 1, 2, 3, 4. BUT, Device Manager is not naming exactly as the ports are labeled at the back and given random order in Device Manager for example Broadcom, Broadcom #1, Broadcom #2, Broadcom #3. It can be the Broadcom #2 in Device Manager is port number 1 at the back. I saw two engineers of my vendor how they did is one engineer is looking network connections at the front of screen and another engineer quickly unplug the cable and plug it back. So the engineer at the front sees the disconnected status on particular network connection and he shout "Hey, that's Local Area Connection 2, what port is that?" and the engineer at the back reply "That's port number 4". So this can't be possible if the engineer is physically not inside the datacenter. So I search around in internet and thanks to all those posts related networking in PowerShell commands. The below PowerShell command is most simplest for me.
Get-NetAdapterHardwareInfo | select Name, InterfaceDescription, DeviceType, Busnumber, Devicenumber, Functionnumber | FL
The result will be in format list like this.
**Name **(This is what you see in Control Panel > .. > Network Connections)
InterfaceDescription (This is what you see in Device Manager)
DeviceType (This is connector type of the NIC)
Busnumber (This is where the NIC is slot on motherboard)
Devicenumber (This is the location number of slot on motherboard)
Functionnumber (This is what you are looking for. Physical port)
So here we got Functionnumber can tell which network connection is belonged to which physical port. But it is in integer number start from 0 but physical port are labelled with real number start from 1. Meaning that Functionnumber 0 is labelled as 1 on physical port on the physical NIC. Funcionnumber 1 is labelled as 2 on physical NIC and so on.
Now it is less hassle free to know which network connection is belonged to which physical port at the back of the server rather than unplug and plug back the cable.