43

To troubleshoot a network problem I would like to inquire the real network "speed" for a given network adapter, which can be seen when opening the "status" of a network connection under Windows: Speed setting

However I want to inquire this over the command line or with a small, separate tool because I need to request this for multiple network connections and don't trust the user to fetch the information properly. The network card "Speed/Duplux" setting is always "Auto Negotiate", so I can't tell from that what "Speed" I will get.

4 Answers 4

68

Try this WMI query:

wmic NIC where NetEnabled=true get Name,Speed

That should give you the speed of all active network connections.

Edit: as has been pointed out, this query has to be modified to work in PowerShell (it works fine in cmd.exe though). Then again, in PowerShell you don't need to use WMI at all:

Get-NetAdapter | where Status -eq "Up" | select InterfaceDescription, LinkSpeed

As a bonus, this gives the speed in a nice, human-readable format (e.g. "1 Gbps"), rather than the number of bits per second.

5
  • 1
    and if you have sed wmic NIC where NetEnabled=true get Name, Speed | sed -e s/000000000/Gbit/ | sed -e s/000000\b/Mbit/
    – Jamie Cook
    Nov 24, 2014 at 2:04
  • 2
    That WMI query worked in Windows 8 cmd, but in Windows 7, I had to use this: wmic NIC where "NetEnabled='true'" get "Name,Speed" It seems that the cmd shell was trying to interpret the ',' as a space or command separator. PowerShell has this problem, also. Thanks for putting me on the right path!
    – The Dude
    Nov 25, 2014 at 19:39
  • Just what I needed! You are a great person ;n; +1 (P.S. is that bits-per-second?) Apr 26, 2019 at 20:43
  • 1
    @CardinalSystem Yes, it's bits per second.
    – Indrek
    Apr 27, 2019 at 21:35
  • Hi. Does anyone know how to get the same from Win32 APIs? Jan 21, 2021 at 3:29
6

From Indrek's answer:

wmic NIC where NetEnabled=true get Name, Speed

will work in the Command Prompt. For PowerShell use:

wmic NIC where "NetEnabled='true'" get "Name,Speed"

(The where clause, and any get attribute (like Name and Speed), must be enclosed in double quotes and comma-delimited).

// Edit #1: GET expression Name,Speed has to be enclosed within a single set of double quotes. Get expressions may not have a space between them

3
  • That's strange. It works without the quotes here.
    – DavidPostill
    Jun 4, 2016 at 10:40
  • @DavidPostill It breaks the GET expression in PS (once you add a second item). Oct 20, 2016 at 5:32
  • 1
    Ah. Confirmed. You should add to your answer that the quotes are required for PowerShell and not needed in a cmd shell.
    – DavidPostill
    Oct 20, 2016 at 7:18
2

I would like to contribute to your share. If you need to run sed in Windows, you can download UnxUtils, then extract sed.exe into c:\Windows\System32

Then when you pipe with sed like you suggested, it works. (Windows 8.1)

Thanks.

wmic NIC where NetEnabled=true get Name, Speed | sed -e s/000000000/Gbit/ | sed -e s/000000\b/Mbit/
2
  • \b doesn't work with sed in Cygwin. What works for me is [^0]. Or, to be complete: s/000000[^0]/Mbit/
    – pepoluan
    Apr 11, 2016 at 2:30
  • Except that will swallow the first non-zero character after 000000, which might not be what you want.
    – Wodin
    Apr 28, 2016 at 8:13
-1

You can also use:

cat /sys/class/net/enp6s0/speed

Or when it's eth0, to determine your speed connection (100 or 1000):

cat /sys/class/net/eth0/speed

2
  • so why is the answer downvoted.? Feb 13, 2019 at 12:02
  • 2
    I don't know, it seems still zero here :S. Ow mabye because this is Linux only.. Mar 1, 2019 at 18:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.