Longterm Internet Connection Speedtest In Linux … With PowerShell ??
Sun, Mar 5, 2017
1-minute read
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
$outfile = "speedtest.csv"
[regex]$regexDl="Download\:\s(?'speed'\d+\.\d+)\s"
[regex]$regexUl="Upload\:\s(?'speed'\d+\.\d+)\s"
"Date;Time;Download;Upload;" | Out-File $outfile -Encoding utf8
while (1 -eq 1) {
Write-Host -ForegroundColor Green "doing speedtest..."
$meas = $(speedtest)
$meas
$download = $regexDl.Match($meas).Groups[1].Value.Replace(".",",")
$upload = $regexUl.Match($meas).Groups[1].Value.Replace(".",",")
"$(Get-Date -Format "yyyy-mm-dd;HH:mm:ss");$download;$upload;" | Out-File $outfile -Encoding utf8 -Append
Start-Sleep -Seconds 300
}
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!