Speedtest.net CLI + Powershell

A few days ago I found myself needing to do a an internet speedtest at one of our remote offices. Users were complaining about “slow speeds” when they tried to connect to (definitely not Facebook or Youtube they told me) some of our business applications, email, etc, etc. Generally I like to do things without interrupting the users so, to begin with, I do the usual internal checks to make sure things are running smoothly. Last thing to check was their internet connection. That’s when it occurred to me that it sure would be nice to use powershell open up a remote session to one of the on-site computers, run a quick speedtest, make sure every thing looks good then close the session. All without having to bug a user onsite to use their computer for a few minutes. Unfortunately, I didn’t find anything quick or simple.

After a little more googling around I stumbled on this little gem from speedtest.net. Pretty dang cool. It comes packaged into a single neat executable that runs completely stand alone. All my problems solved right? Well yea, but this is a powershell website, and if I couldn’t bend it to powershell’s will then what kind of sysadmin would I be?

One of the neat things about this little program is that it will spit out multiple outputs with the -f switch. So if I wanted to get the JSON output I would use:

.\speedtest.exe “google.com” -f json

And get this as an output:

You can also get outputs for csv, tsv, json, jsonl, json-pretty, but we’re going to use the JSON output to pull it into powershell as an object. It takes two whole lines of script to accomplish this.

$speedtest_data = .\speedtest.exe “google.com” -f json | ConvertFrom-Json

Which gives us this:

Nifty eh?

Now if we want, we can pull out the relevant bits we want to use. For example, if I just wanted the “download” bit I could use:


Which would give me this:

Next step I think will be automating sending the file to the remote device, running the script, and viewing the results in one quick step, but that’ll be for another post.

Download the Speedtest CLI here: https://www.speedtest.net/apps/cli

Got any ideas on other ways this could be used? Comment below!

Leave a Reply

Your email address will not be published. Required fields are marked *