Getting network interface device name in powershell
Posted
by
Grant
on Server Fault
See other posts from Server Fault
or by Grant
Published on 2012-09-13T20:00:41Z
Indexed on
2012/09/13
21:40 UTC
Read the original article
Hit count: 282
powershell
I needed a powershell 2 script to get the name and device name of each interface like it is shown in network connections in control panel.
Should be easy...
$interfaces = Get-WmiObject Win32_NetworkAdapter
$interfaces | foreach {
$friendlyname = $_ | Select-Object -ExpandProperty NetConnectionID
$name = $_ | Select-Object -ExpandProperty Name
}
However, $name comes back as "Broadcom BCM5709C NetXtreme II GigE (NDIS VBD Client)", whereas in control panel it shows "Broadcom BCM5709C NetXtreme II GigE (NDIS VBD Client) #69", because there are multiple cards. I can't find that number anywhere in the properties.
How can I get both the Name and Device Name, exactly as shown in Network Connections, in powershell 2 on windows server 2008 r2?
© Server Fault or respective owner