1

How to get the type of an network adapter (Wi-Fi, Ethernet, Bluetooth) in Windows Powershell?

Currently I am using: get-wmiobject win32_networkadapter -filter "PhysicalAdapter = true" | select *

Which gives a lot of information about about every adapter. The property "name" contains some indication which type of device it is, but is there something like an Id that tells me the type:

Here is a sample of one adapter:

PSComputerName              : XXXXXXXXXXXX
Availability                : 3
Name                        : Intel(R) Wi-Fi 6 AX201 160MHz
Status                      :
StatusInfo                  :
DeviceID                    : 2
__GENUS                     : 2
__CLASS                     : Win32_NetworkAdapter
__SUPERCLASS                : CIM_NetworkAdapter
__DYNASTY                   : CIM_ManagedSystemElement
__RELPATH                   : Win32_NetworkAdapter.DeviceID="2"
__PROPERTY_COUNT            : 40
__DERIVATION                : {CIM_NetworkAdapter, CIM_LogicalDevice, CIM_LogicalElement, CIM_ManagedSystemElement}
__SERVER                    : XXXXXXXX
__NAMESPACE                 : root\cimv2
__PATH                      : \\XXXXXXXXX\root\cimv2:Win32_NetworkAdapter.DeviceID="2"
AdapterType                 : Ethernet 802.3
AdapterTypeId               : 0
AutoSense                   :
Caption                     : [00000002] Intel(R) Wi-Fi 6 AX201 160MHz
ConfigManagerErrorCode      : 0
ConfigManagerUserConfig     : False
CreationClassName           : Win32_NetworkAdapter
Description                 : Intel(R) Wi-Fi 6 AX201 160MHz
ErrorCleared                :
ErrorDescription            :
GUID                        : {FDFFD175-8A12-4FFC-B5A7-583B96A192C0}
Index                       : 2
InstallDate                 :
Installed                   : True
InterfaceIndex              : 26
LastErrorCode               :
MACAddress                  : BC:17:B8:61:B8:9A
Manufacturer                : Intel Corporation
MaxNumberControlled         : 0
MaxSpeed                    :
NetConnectionID             : WLAN
NetConnectionStatus         : 2
NetEnabled                  : True
NetworkAddresses            :
PermanentAddress            :
PhysicalAdapter             : True
PNPDeviceID                 : PCI\VEN_8086&DEV_06F0&SUBSYS_00708086&REV_00\3&11583659&0&A3
PowerManagementCapabilities :
PowerManagementSupported    : False
ProductName                 : Intel(R) Wi-Fi 6 AX201 160MHz
ServiceName                 : Netwtw10
Speed                       : 1451650000
SystemCreationClassName     : Win32_ComputerSystem
SystemName                  : XXXXXXXXX
TimeOfLastReset             : 20220104082447.500000+060
Scope                       : System.Management.ManagementScope
Path                        : \\20IAV500030N-0\root\cimv2:Win32_NetworkAdapter.DeviceID="2"
Options                     : System.Management.ObjectGetOptions
ClassPath                   : \\XXXXXXXX\root\cimv2:Win32_NetworkAdapter
Properties                  : {AdapterType, AdapterTypeId, AutoSense, Availability...}
SystemProperties            : {__GENUS, __CLASS, __SUPERCLASS, __DYNASTY...}
Qualifiers                  : {dynamic, Locale, provider, UUID}
Site                        :
Container                   :
Chriss
  • 5,157
  • 7
  • 41
  • 75
  • 1
    You could try `(Get-NetAdapter).PhysicalMediaType`. – AdminOfThings Jan 04 '22 at 14:06
  • I want to try it: but where should I put `(Get-NetAdapter).PhysicalMediaType` ? – Chriss Jan 04 '22 at 14:10
  • 2
    Run it like you did the previous command and see the results. If they are to your liking, then we can incorporate that into a prettier output. – AdminOfThings Jan 04 '22 at 14:12
  • the output is rather short, just a list like `Native 802.11 Unspecified 802.3 Unspecified BlueTooth 802.3 802.3` But how to map it to the corresponding adapter? – Chriss Jan 04 '22 at 14:15
  • 3
    You can view the properties available by using `Get-NetAdapter | Format-List *`. Using that property view, you can then pipe to `Select-Object` and choose the appropriate properties -> `Get-NetAdapter | Select Name,PhysicalMediaType,MacAddress,InterfaceDescription` is an example. You can combine outputs from multiple commands using [Calculated Properties](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_calculated_properties?view=powershell-7.2). – AdminOfThings Jan 04 '22 at 14:19
  • Note that `Get-WmiObject` is not available in PowerShell 6+. Use `Get-CimInstance`. – lit Jan 04 '22 at 15:57

2 Answers2

2

The following PowerShell command returns the type of the adapter:

Get-NetAdapter  * | Format-List -Property "Name", "InterfaceDescription" ,"PhysicalMediaType"

Sample output:

Name                 : WLAN
InterfaceDescription : Intel(R) Wi-Fi 6 AX201 160MHz
PhysicalMediaType    : Native 802.11
 
Name                 : vEthernet (Default Switch)
InterfaceDescription : Hyper-V Virtual Ethernet Adapter
PhysicalMediaType    : Unspecified

Name                 : Bluetooth-Netzwerkverbindung
InterfaceDescription : Bluetooth Device (Personal Area Network)
PhysicalMediaType    : BlueTooth

Name                 : Ethernet 2
InterfaceDescription : Intel(R) Ethernet Connection (10) I219-LM
PhysicalMediaType    : 802.3

PhysicalMediaType

  • 802.3 -> Ethernet
  • BlueTooth -> guess what
  • Native 802.11 -> WLAN

Thx to @AdminOfThings for the support!

Chriss
  • 5,157
  • 7
  • 41
  • 75
1

Get-NetAdapter | ft Name,InterfaceDescription,PhysicalMediaType,NdisPhysicalMedium -AutoSize

Result is something like enter image description here

Where for NdisPhysicalMedium:

  • WiFi = 9
  • BlueTooth = 10
  • Ethernet = 14
Ladislav
  • 320
  • 3
  • 10