Longterm Internet Connection Speedtest In Linux … With PowerShell ??

Something weird just happened: I’ve actually created the first PowerShell script that now regularly runs on my main Linux machine … the start of something new? …

I’ve been using PowerShell, well, A LOT at work lately – and the syntax is just so easy and straight forward – you gotta love it, even as a dedicated Linux user 😉

Script Speedtest.ps1

<br />
$outfile = &quot;speedtest.csv&quot;</p>
<p>[regex]$regexDl=&quot;Download\:\s(?'speed'\d+\.\d+)\s&quot;<br />
[regex]$regexUl=&quot;Upload\:\s(?'speed'\d+\.\d+)\s&quot;</p>
<p>&quot;Date;Time;Download;Upload;&quot; | Out-File $outfile -Encoding utf8</p>
<p>while (1 -eq 1) {<br />
    Write-Host -ForegroundColor Green &quot;doing speedtest...&quot;<br />
    $meas = $(speedtest)<br />
    $meas<br />
    $download = $regexDl.Match($meas).Groups[1].Value.Replace(&quot;.&quot;,&quot;,&quot;)<br />
    $upload = $regexUl.Match($meas).Groups[1].Value.Replace(&quot;.&quot;,&quot;,&quot;)</p>
<p>    &quot;$(Get-Date -Format &quot;yyyy-mm-dd;HH:mm:ss&quot;);$download;$upload;&quot; | Out-File $outfile -Encoding utf8 -Append<br />
    Start-Sleep -Seconds 300<br />
}<br />

The results will be shared in a couple of days when I’ve collected a significant amount of data!

Update: first results – upload speed pretty constant, download unstable!

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.