How to remotely check your home/work internet speed
Part of my work routine of phone calls involves someone calling me up, usually right as I sit down to lunch, and asking if the internet is slow at work, down, or something is wrong.
I’m usually not at the office when this happens, and running them through going to speedtest.net and running a speed test is five more minutes of work, while I’m trying to eat or order food.
In the past it involved me remoting into my computer and running a speed test and trying to navigate my work’s 3 monitor setup on my cell phone, but no more.
Now that I’ve got TRIGGERcmd, I just ask Google Assistant to tell TRIGGERcmd to check the work internet speed, and about two minutes later I have a report I can view on my phone.
For this you’ll need a free dropbox account, and something that can run Powershell (Windows,) – I’ll probably Python this up later but for now no.
Flipping the script
First off, I used this script to check the internet speed.
If you’re not familiar with PowerShell scripts, just open a notepad, notepad++, whatever, cut and paste that in, save as c:\scripts\speedtest.ps1 or similar.
Test the script in powershell like c:\scripts\speedtest.ps1 and see if it works. If it does, time to modify the script a bit. Powershell mind you, not CMD.
Lines 34 & 35 find the latitude and longitude of the connection in order to locate a good server. For me this was grabbing somewhere pretty far off and I was getting the wrong servers so I went into Google Maps, clicked on an area near me, and hardcoded the latitude and longitude.
$oriLat = 36.165314
$oriLon = -86.785726
After that I modified lines 97 on to read similar to this:
$time = Get-Date
mv C:\Users\paul\Dropbox\st.txt C:\Users\paul\Dropbox\st.old
Write-Host “Wan Speed is $($Wanspeed) Mbit/Sec”
Add-Content C:\Users\paul\Dropbox\st.txt $time
Add-Content C:\Users\paul\Dropbox\st.txt “Wan Speed is $($Wanspeed) Mbit/Sec”
gc C:\Users\paul\Dropbox\st.txt,C:\Users\paul\Dropbox\st.old -Enc Byte -Read 512 | sc C:\Users\paul\Dropbox\new.txt -Enc Byte
Rename-Item C:\Users\paul\Dropbox\new.txt C:\Users\paul\Dropbox\st.txt
Basically it writes to the console and also to a file. It appends the current time and speed to the beginning of the document. I’m pretty sure this could be done in a couple of lines but I was busy and it makes sense (to me,) and works so I’m not really working more on it at this point.
I also changed the file on line 4 to be random4000x4000.jpg as the larger file got more accurate results.
What did that do?
The bulk of it just runs the speed test. The last few lines just add time and speed to the beginning of a text file.
This text file gets saved in my dropbox folder, synced immediately, and then is available for easy viewing.
How it’s triggered
In TRIGGERcmd I set up a command to launch “powershell -Command <filename>” with a voice command to test work speed.
I can now get a call to check it, hang up, ask Assistant to tell TRIGGERcmd to test work speed, and let the script and dropbox deliver me a little text file that shows me the current speed rather than having to log in to Chrome Remote Desktop and launch speedtest.
This is a short kludge, my hope is to shortly have it do more detailed reporting on what’s happening in the network (running some point to point speed tests between machines,) and either email me a status report or speak it back out through Assistant.
You could also set an event (cron, task scheduler,) to run this automatically every hour or two