简体   繁体   中英

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

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 * 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                   :

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!

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

Result is something like在此处输入图像描述

Where for NdisPhysicalMedium :

  • WiFi = 9
  • BlueTooth = 10
  • Ethernet = 14

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM