Enumerating Network Adapters

by Nov 24, 2010

Finding your network adapters with WMI isn't always easy because WMI treats a lot of "network-like" adapters like network adapters. To find only those adapters that are also listed in your control panel, you should make sure to filter out all adapters that have no NetConnectionID, which is the name assigned to a network adapter in your control panel:

function Get-NetworkAdapter {
Get-WmiObject Win32_NetworkAdapter Filter 'NetConnectionID!=null'
}

With your new function, you can then easily list all network adapters and check their status. For example:

Get-NetworkAdapter | select caption, NetCon*

Twitter This Tip!
ReTweet this Tip!