Advertisement
guyrleech

Download & run Ookla Internet Speedtest Tool

Aug 11th, 2024 (edited)
578
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PowerShell 1.31 KB | Cybersecurity | 0 0
  1. ## run internet speed test using CLI tool from Ookla https://www.speedtest.net/apps/cli - download, unzip & place in cwd
  2. ## this will find the hyperlink for the Windows download, which is version specific, and download it
  3.  
  4. 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
  5.  
  6. ## this will extract to the current working directory (cwd)
  7. [System.IO.Compression.ZipFile]::ExtractToDirectory( (Join-Path (Get-Location) "speedtest.zip") , (Get-Location) )
  8.  
  9. ## 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
  10.  
  11. $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}}
  12.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement