Using PowerShell to display network adapters

by Mitch Tulloch [Published on 24 July 2013 / Last Updated on 24 July 2013]

A tip on how you can use Windows PowerShell to display network adapters with 100-Mbps link speed on servers running Windows Server 2012.

You can use the Get-NetAdapter cmdlet to display all network adapters on the server that have a link speed of 100 megabits per second (Mbps) like this:

PS C:\> Get-NetAdapter | Where-Object -FilterScript {$_.LinkSpeed -eq "100 Mbps"}

Name           InterfaceDescription       ifIndex     Status  MacAddress                LinkSpeed
-----------       ------------------------------      -------         ------      --------------------             ---------
Ethernet 2  Broadcom NetXtreme      Gig...  13  Up        A4-BA-DB-0A-96-0C  100 Mbps
Ethernet     Broadcom NetXtreme      Gig...  12  Up         A4-BA-DB-0A-96-0B  100 Mbps

The output of this command consists of objects that can be passed through the pipeline to other cmdlets. For example, you could pipe the output into the Set-NetIPInterface cmdlet to assign a metric value of 5 to all interfaces having a link speed of 100 Mbps as follows:

PS C:\> Get-NetAdapter | Where-Object -FilterScript {$_.LinkSpeed -eq "100 Mbps"} | `
Set-NetIPInterface -InterfaceMetric 5

This tip is excerpted from my latest book Training Guide: Installing and Configuring Windows Server 2012 from Microsoft Press.

Mitch Tulloch is a nine-time recipient of the Microsoft Most Valuable Professional (MVP) award and a widely recognized expert on Windows administration, deployment and virtualization.  For more information see http://www.mtit.com.

See Also

Featured Links