Use PowerShell 3.0 to Work with Network Adapters

Doctor Scripto

Summary: Learn how to use the Get-NetAdapter CIM cmdlet in Windows PowerShell 3.0.

Microsoft Scripting Guy, Ed Wilson, is here. I must live a rather boring life—although to be honest, it does not really seem to be so boring. Or perhaps, I am just a geek. What am I talking about? I am really excited about the Get-NetAdapter cmdlet in Windows 8 and Windows Server 2012 with Windows PowerShell 3.0. It allows me to easily determine the status of my network adapter. Perhaps because I spend so much time traveling around with my laptop, I am constantly connecting to various networks—wired or wireless.

Personally, I do not like the idea of bridged network connections, and therefore, I always disable the network adapter that I am not currently using. At times, however, I do forget to re-enable that network adapter, and I always spend a few mips before I remember to toggle my network adapters. I wrote a Hey, Scripting Guy! Blog about this a few years ago, How Can I Enable or Disable My Network Adapter. Although it was a cool script, it was a lot of work. With Windows 8 and Windows Server 2012 with Windows PowerShell 3.0, all that has changed—working with network adapters is a piece of cake.

Find and identify your network adapters

The Get-NetAdapter cmdlet returns the name, interface description, index number, and status of all network adapters that are present on the system. This is the default display of information, and it is shown in the image that follows.

Image of command output

To focus on a particular network adapter, I use the name parameter and supply the name of the network adapter. The good thing is that in Windows 8 and Windows Server 2012 the network connections receive new names. No more of the “local area connection” and “local area connection(2)” to attempt to demystify. The wired network adapter is simply Ethernet and the wireless network adapter is Wi-Fi. The following command retrieves only then Ethernet network adapter.

Get-NetAdapter -Name Ethernet

To dive into the details of the Ethernet network adapter, I pipe the returned object to the Format-List cmdlet, and I choose all of the properties. The command shown here uses the fl alias for the Format-List cmdlet.

Get-NetAdapter -Name ethernet | fl *

The command and the output associated with the command are shown in the following image.

Image of command output

There are a number of excellent properties that might bear further investigation. For example, there are the AdminStatus and the MediaConnectionStatus properties. The following command returns these properties.

Get-NetAdapter -Name ethernet | select adminstatus, MediaConnectionState

Of course, there are other properties that might be interesting also. These properties are shown here, along with the associated output (the following is a single logical command broken on two lines).

Get-NetAdapter -Name ethernet |

select ifname, adminstatus, MediaConnectionState, LinkSpeed, PhysicalMediaType


ifName               : Ethernet_7

AdminStatus          : Down

MediaConnectionState : Unknown

LinkSpeed            : 0 bps

PhysicalMediaType    : 802.3

I decide to look only for network adapters that are in the admin status of up. I use the command shown here.

PS C:\> Get-NetAdapter | where adminstatus -eq “up”


Name                      InterfaceDescription                    ifIndex Status

—-                      ——————–                    ——- ——

vEthernet (InternalSwi… Hyper-V Virtual Ethernet Adapter #3          22 Up

vEthernet (ExternalSwi… Hyper-V Virtual Ethernet Adapter #2          19 Up

Bluetooth Network Conn… Bluetooth Device (Personal Area Netw…      15 Disconn…

Wi-Fi                     Intel(R) Centrino(R) Ultimate-N 6300…      12 Up

To find the disabled network adapters, I change the AdminStatus from up to down as shown here.

Get-NetAdapter | where adminstatus -eq “down”

I go back to my previous command, and modify it to return Wi-Fi information. This command and associated output are shown here (this is a single logical command).

PS C:\> Get-NetAdapter -Name wi-fi |

select ifname, adminstatus, MediaConnectionState, LinkSpeed, PhysicalMediaType


ifName               : WiFi_0

AdminStatus          : Up

MediaConnectionState : Connected

LinkSpeed            : 54 Mbps

PhysicalMediaType    : Native 802.11

If I want to find any network adapters that are sniffing the network, I look for PromiscousMode. This command is shown here.

Get-NetAdapter | ? PromiscuousMode -eq $true

Join me tomorrow when I will present additional information about using Windows PowerShell 3.0 to work with network adapters.

I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, peace.

Ed Wilson, Microsoft Scripting Guy


Discussion is closed.

Feedback usabilla icon