Last active
August 29, 2015 14:18
-
-
Save bklockwood/5fea04e28f4730c9a129 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-DownloadSpeed | |
{ | |
[CmdletBinding()] | |
Param | |
( | |
# Param1 help description | |
[Parameter(Mandatory=$true, Position=0)] | |
$SpeedtestServer, | |
# Param2 help description | |
[Parameter(Mandatory=$true, Position=1)] | |
$DownLoad | |
) | |
Process | |
{ | |
[string]$testurl = $SpeedtestServer + $DownLoad | |
try { | |
$Error = $null | |
$time = measure-command {$dl = Invoke-WebRequest -uri $testurl -TimeoutSec 1} | |
} catch { | |
write-host "Error downloading $testurl " | |
write-host $dl | |
break | |
} | |
$result = $($dl.RawContentLength) / $($time.totalseconds) | |
$resultmb = $result / 1000000 | |
$resultmb = [math]::Round($resultmb,2) #round to 2 decimal places | |
$dlmb = $($dl.RawContentLength) / 1000000 | |
$dlmb = [math]::Round($dlmb,2) | |
$secs = $($time.totalseconds) | |
$secs = [math]::Round($secs,2) | |
Write-host "$testurl downloaded $dlmb Mbit in $secs seconds at $resultmb Mbit/s" | |
} | |
} | |
$dl500 = "/speedtest/random500x500.jpg" | |
$dl1000 = "/speedtest/random1000x1000.jpg" | |
$dl2000 = "/speedtest/random2000x2000.jpg" | |
$testserver = "www.irongoat.net/speedtest" | |
#Get-DownloadSpeed $testserver $dl500 | |
#Get-DownloadSpeed $testserver $dl1000 | |
Get-DownloadSpeed $testserver $dl2000 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A typical response:
Using the speedtest.net web interface pointed at this same server, 70Mbit/sec results are common. Never as low as 3Mbit/sec