Author Posts

February 10, 2014 at 5:28 am

Hi guys!

I searched a lot on Google, but most scripts are not working or only showing the link speed from the network card (100/1000). I would like to do a speedtest with PowerShell so I can include the internet speed in my report. Is that possible?
I'm still a newbie on PowerShell (19 years old), so I'm sorry if this is easy to make. 🙂

Thanks.

Best regards,

Jean-Paul

February 11, 2014 at 4:21 pm

Before considering implementation for a speedtest, you need to define what you mean when you say network speed. How do you define network speed (is it pure upload/download speed for TCP communication between computer A and B or is it something else you're looking for) and between which endpoints (exactly which computers are you going to use and are they two computers on same local network, other country, other side of the globe)?

February 12, 2014 at 2:26 am

Hi Robert. Thanks for your answer. It must be something like speedtest.net. So it's pure upload and download speed between a (public, maybe speedtest.net if possible) server.

February 12, 2014 at 2:45 am

To calculate pure upload and download speed is pretty easy, especially if you have control over both the server and the client. Just make UploadFile and DownloadFile requests (which you can do using the Invoke-WebRequest cmdlet or the HttpClient or WebClient .NET classes), measure the time it takes and divide the file size with the time measured. Do be sure to upload both small and slightly larger files, to account for connection opening and similar.

However, if the server is not yours and you keep downloading and uploading a lot of large dummy files (especially if you run it from several different machines at the same time) it could be considered less nice (bordering on DOS-attack, possibly?), in which case I suggest contacting the server owner before doing any such thing.

February 12, 2014 at 3:00 am

OK, that's also possible indeed. I'd hoped for something like Speedtest.net in PowerShell, but that's not possible so I have to make my own speedtest. 🙂 Thanks for the commands and help!

February 12, 2014 at 3:16 am

Speedtest.net is a flash application, so it's not really a great fit for controlling via PowerShell. In theory you could automate the webbrowser to start the speedtest.net test and once it's done somehow get the data out of the flash application (either if it's available through some javascript calls to the flash API, peeking into the flash gui objects or by doing OCR on the flash GUI displaying the numbers). I do, however, believe that this would be a lot more difficult (have never tried controlling flash applications from PowerShell so I can't make any educated comments on the difficulty level) than just making the calculations yourself (which should be pretty easy, once you know which server you want to communicate with).

February 12, 2014 at 4:48 am

No indeed. Thanks for the help Robert!