Home » PowerShell Get-NetAdapter

PowerShell Get-NetAdapter

The Get-NetAdapter cmdlet in PowerShell is used to get the basic network adapter properties. It returns visible adapters by default.

The Get-NetAdapter cmdlet retrieves common adapter properties, you can use the Format-List cmdlet to see adapter properties. To see all the properties, use the Property parameter with the wildcard character “*“.

In this article, we will discuss how to use Get-NetAdapter to get all visible network adapters, and hidden adapters, retrieve all physical network adapters, get a network adapter specified by the name, display common properties for network adapter, and display all properties for the specified network adapter.

What is the Syntax of Get-NetAdapter

The Get-NetAdapter cmdlet syntax is given below.

Get-NetAdapter
   -InterfaceIndex <UInt32[]>
   -InterfaceDescription <String[]>
   [[-Name] <String[]>]
   [-IncludeHidden]
   [-Physical]
   [-CimSession <CimSession[]>]
   [-ThrottleLimit <Int32>]
   [-AsJob]
   [<CommonParameters>]

How to Get All Visible Network Adapters

To get all visible network adapters in the system, use the `Get-NetAdapter` cmdlet in PowerShell.

Get-NetAdapter -Name *

In the above PowerShell script, the Get-NetAdapter cmdlet uses the -Name parameters to get and display all of the visible network adapters.

How to Get Visible and Hidden Network Adapters

You can use the Get-NetAdapter cmdlet with the -IncludeHidden parameter to retrieve visible and hidden network adapters.

Get-NetAdapter -Name * -IncludeHidden

How to Get All Physical Network Adapters

Use the Get-NetAdapter command with the -Physical parameter to get all of the physical network adapters in the system.

Get-NetAdapter -Name * -Physical

How to Get a Network Adapter by the Specified Name

To get a network adapter by the specified name, use the Get-NetAdapter command with the -Name parameter to specify the network adapter.

Get-NetAdapter -Name "Ethernet"

In the above PowerShell script, the Get-NetAdapter command gets a network adapter named “Ethernet“.

How to Display the Common Properties of the Specified Network Adapter

The Get-NetAdapter command displays the common properties of the network adapter by default. Use the -FormatList cmdlet to format the list.

Get-NetAdapter -Name "Ethernet*" | Format-List  

In the above PowerShell script, the Get-NetAdapter retrieves the common properties of the specified network adapter that begins with the name “Ethernet*” and pipes them to the Format-List cmdlet to display the common properties.

The output of the above PowerShell script to display the common properties of the network adapter is:

PS C:\> Get-NetAdapter -Name "Ethernet*" | Format-List                                                                                      

Name                       : Ethernet 2
InterfaceDescription       : Cisco AnyConnect Secure Mobility Client Virtual Miniport Adapter for Windows x64
InterfaceIndex             : 13
MacAddress                 : 00-05-A3-4D-8A-00
MediaType                  : 802.3
PhysicalMediaType          : Unspecified
InterfaceOperationalStatus : Down
AdminStatus                : Down
LinkSpeed(Mbps)            : 862.4
MediaConnectionState       : Unknown
ConnectorPresent           : False
DriverInformation          : Driver Date 2019-05-01 Version 4.7.3045.0 NDIS 6.20

Name                       : Ethernet
InterfaceDescription       : Intel(R) Ethernet Connection (4) I219-LM
InterfaceIndex             : 11
MacAddress                 : 6C-03-CA-2B-12-58
MediaType                  : 802.3
PhysicalMediaType          : 802.3
InterfaceOperationalStatus : Down
AdminStatus                : Up
LinkSpeed(Mbps)            : 0
MediaConnectionState       : Disconnected
ConnectorPresent           : True
DriverInformation          : Driver Date 2017-12-27 Version 12.17.8.9 NDIS 6.50

How to Display All Properties for the Specified Network Adapter

To display all properties for the specified network adapter, use the following script that uses the Get-NetAdapter command with the Properties * parameter.

Get-NetAdapter -Name "Ethernet" | Format-List -Property * 

Cool Tip: How to get the network adapter driver version in PowerShell!

How to Get All Network Adapters using the Interface Description

The `Get-NetAdapter` cmdlet in PowerShell has the -InterfaceDescription parameter. The following command gets all of the network adapters using the interface description that matches the pattern.

Get-NetAdapter -InterfaceDescription "Hyper-V*" 

The output of the above PowerShell script retrieves the network adapters using the interface description that matches the prefix pattern “Hyper-V*“.

PowerShell Get-NetAdapter using Interface Description
PowerShell Get-NetAdapter using Interface Description

Cool Tip: How to get network adapter IP address using PowerShell!

Conclusion

I hope the above article on the Get-NetAdapter cmdlet in PowerShell to get all the visible network adapters in the system.

You can find more topics about Active Directory tools and PowerShell basics on the ActiveDirectoryTools home page.