Se7en
Se7en

Reputation: 443

Detect Ethernet adapter(s) - PowerShell

I am using this code to detect network adapters:

(Get-NetAdapter).InterfaceDescription

The problem with this code is that it detects all network adapters (including Wi-Fi and virtual adapters by VMware).

I just want to detect the ethernet adapters installed in the device.

Could PowerShell do this at all?

Upvotes: 3

Views: 1250

Answers (2)

(Get-NetAdapter -Physical | Where-Object {$_.PhysicalMediaType -eq "802.3"}).InterfaceDescription

Will get all physical network adapters having PhysicalMediaType 802.3 (Ethernet).

Upvotes: 3

swani14
swani14

Reputation: 34

Get-NetAdapter | Where-Object {$_.InterfaceDescription -match "Ethernet"}

This will show onboard ethernet adapters as well as docking station/USB Ethernet adapters.

Upvotes: 1

Related Questions