Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## run internet speed test using CLI tool from Ookla https://www.speedtest.net/apps/cli - download, unzip & place in cwd
- ## this will find the hyperlink for the Windows download, which is version specific, and download it
- Invoke-WebRequest -uri (Invoke-WebRequest -Uri https://www.speedtest.net/apps/cli|select -ExpandProperty links|Where-Object outerhtml -match 'download for windows'|select -expand href) -OutFile speedtest.zip
- ## this will extract to the current working directory (cwd)
- [System.IO.Compression.ZipFile]::ExtractToDirectory( (Join-Path (Get-Location) "speedtest.zip") , (Get-Location) )
- ## CLI tool Output is json so we get the result summary and use to make calculated properties of the interesting/useful numbers & cross reference IP address to the NIC used
- $now = get-date;& ".\speedtest.exe" --accept-license --accept-gdpr -p -f json|select -last 1|ConvertFrom-Json | select @{n='Date';e={$now}},isp,@{n='Download (Mb/s)';e={$_.download.bandwidth / 1E6 * 8}},@{n='Upload (Mb/s)';e={$_.upload.bandwidth / 1E6 * 8}},@{n='Server';e={"$($_.Server.name), $($_.Server.location), $($_.server.Country)"}},@{n='Interface';e={$n=$_;$script:nic = Get-NetIPConfiguration|Where-Object { $n.interface.internalIp -in $_.ipv4address.ipaddress } ; $script:nic.InterfaceAlias}},@{n='NIC';e={$script:nic.InterfaceDescription}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement