简体   繁体   English

如何在 Windows Powershell 中获取网络适配器(Wi-Fi、以太网、蓝牙)的类型?

[英]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?如何在 Windows Powershell 中获取网络适配器(Wi-Fi、以太网、蓝牙)的类型?

Currently I am using: get-wmiobject win32_networkadapter -filter "PhysicalAdapter = true" | select *目前我正在使用: 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:属性“名称”包含一些指示它是哪种类型的设备,但是否有类似 Id 的东西告诉我类型:

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:以下 PowerShell 命令返回适配器的类型:

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

Sample output:样品 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 802.3 -> 以太网
  • BlueTooth -> guess what BlueTooth ->猜猜是什么
  • Native 802.11 -> WLAN Native 802.11 -> WLAN

Thx to @AdminOfThings for the support!感谢@AdminOfThings的支持!

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

Result is something like结果类似于在此处输入图像描述

Where for NdisPhysicalMedium : NdisPhysicalMedium在哪里:

  • WiFi = 9无线网络 = 9
  • BlueTooth = 10蓝牙 = 10
  • Ethernet = 14以太网 = 14

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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