mnagel
Professor
6 years agoOokla Speedtest
After a few failed attempts to get this working on Windows via Powershell (works, but too inaccurate), I punted and used speedtest-cli. If I can replicate that into Groovy, then perhaps it could b...
1 hour ago, mnagel said:$size = 50 $mirror = "##speedtest.testmy.mirror##" if ( $mirror -eq "" ) { $url = "https://testmy.net/dl-${ $size }MB" } else { $url = "https://${ mirror }.testmy.net/dl-${ $size }MB" } $timer = Measure-Command { $response = invoke-webrequest -uri $url } $result = ( $size / ( $timer ).TotalSeconds ) * B $mbps = "{0:N2}" -f ( $result ) Write-Host "Mbps=$mbps"
I changed the first If () {} to test the correct variable (was $site, which isn't represented anywhere else in the script). Then I cleaned the code up a bit and lined everything up... OCD is both great and horrible for programming.