QuickTip: Get wireless network adapter with PowerShell

If you want to retrieve a wireless network adapter with PowerShell, do not use the name property of the Get-NetAdapter cmdlet to filter the adapters by name or with wildcards. This property is unreliable because the name of the adapter may have been changed by a user or administrator and it is different in MultiLanguage deployments (e.g. Wi-Fi on an English OS, WLAN on a German OS).

Use InterfaceType instead:

Get-NetAdapter | ? {$_.InterfaceType -eq "71"}

2016-05-26 15_06_58-Windows PowerShell

The MSFT_NetAdapter class is documented here: https://msdn.microsoft.com/en-us/library/hh968170(v=vs.85).aspx

Unfortunately, the values of the InterfaceType property are not documented exceptionally. But you can find them here: https://technet.microsoft.com/de-de/aa366320

Value 6 equals Ethernet interfaces, value 71 equals wireless network interfaces.

Happy PowerShell scripting!

2 thoughts on “QuickTip: Get wireless network adapter with PowerShell”

  1. The other thing you can check for is MediaType. This is a ScriptProperty that we add to every adapter:
    C:\WINDOWS\system32> $a |gm MediaType |fl *

    TypeName : Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapter
    Name : MediaType
    MemberType : ScriptProperty
    Definition : System.Object MediaType {get=$out = switch ($this.NdisMedium)
    0 {“802.3”}
    3 {“WAN”}
    9 {“Wireless WAN”}
    12 {“Connection Oriented WAN”}
    15 {“Tunnel”}
    16 {“Native 802.11”}
    17 {“Loopback”}
    18 {“WiMAX”}
    19 {“IP”}
    default {“Unknown”}

    Jeffrey Snover[MSFT]

Leave a Reply