Speed test script

I just started using the speed test script in the library but its showing wrong and much lower speed numbers from the script than if I just went to the speedtest.net site. For example, on my workstation, it shows 92.06 download through the script and direct from speedtest.net 925. download which is more accurate. Anything I’m missing ?

Hi @bob
Could you send us more details by creating a Support ticket? We would need the asset you saw this on as well as a link to the script.

Here is my working script. This downloads the Ookla command line tool and uploads a result report to the asset.

# Speedtest script cobbled together mainly from the Ookla site.

# Speedtest script cobbled together from several resources mainly the Ookla site.
# Gary Herbstman, Byte Solutions

Import-Module $env:SyncroModule

<#
To get the latest download URL go to https://www.speedtest.net/apps/cli 
Update the $URL variable below.

Speedtest by Ookla is the official command line client for testing the speed and performance of your internet connection.
Version: speedtest 1.0.0.2

Usage: speedtest [<options>]
  -h, --help                        Print usage information
  -V, --version                     Print version number
  -L, --servers                     List nearest servers
  -s, --server-id=#                 Specify a server from the server list using its id
  -I, --interface=ARG               Attempt to bind to the specified interface when connecting to servers
  -i, --ip=ARG                      Attempt to bind to the specified IP address when connecting to servers
  -o, --host=ARG                    Specify a server, from the server list, using its host's fully qualified domain name
  -p, --progress=yes|no             Enable or disable progress bar (Note: only available for 'human-readable'
                                    or 'json' and defaults to yes when interactive)
  -P, --precision=#                 Number of decimals to use (0-8, default=2)
  -f, --format=ARG                  Output format (see below for valid formats)
  -u, --unit[=ARG]                  Output unit for displaying speeds (Note: this is only applicable
                                    for human-readable output format and the default unit is Mbps)
  -a                                Shortcut for [-u auto-decimal-bits]
  -A                                Shortcut for [-u auto-decimal-bytes]
  -b                                Shortcut for [-u auto-binary-bits]
  -B                                Shortcut for [-u auto-binary-bytes]
      --selection-details           Show server selection details
  -v                                Logging verbosity. Specify multiple times for higher verbosity
      --output-header               Show output header for CSV and TSV formats

 Valid output formats: human-readable (default), csv, tsv, json, jsonl, json-pretty

 Machine readable formats (csv, tsv, json, jsonl, json-pretty) use bytes as the unit of measure with max precision

 Valid units for [-u] flag:
   Decimal prefix, bits per second:  bps, kbps, Mbps, Gbps
   Decimal prefix, bytes per second: B/s, kB/s, MB/s, GB/s
   Binary prefix, bits per second:   kibps, Mibps, Gibps
   Binary prefix, bytes per second:  kiB/s, MiB/s, GiB/s
   Auto-scaled prefix: auto-binary-bits, auto-binary-bytes, auto-decimal-bits, auto-decimal-bytes
#>

# $URL = "https://install.speedtest.net/app/cli/ookla-speedtest-1.0.0-win64.zip"
$URL = "https://install.speedtest.net/app/cli/ookla-speedtest-1.1.1-win64.zip"

$zipFile = "$env:TEMP\speedtest.zip"
$exeFile = "$env:TEMP\speedtest.exe"
$mdFile = "$env:TEMP\speedtest.md"
$resultFilePath = $env:temp + "\" + "Speedtest_" + $(get-date -f yyyy-MM-dd) + ".log"
$exeParams = "--accept-license --progress=no -v"

$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri $URL -OutFile $zipFile -Headers @{"Cache-Control"="no-cache"}
Expand-Archive -Path $zipFile -DestinationPath "$env:TEMP\" -Force 

# Runs Speedtest and outputs to a text file
Start-Process -FilePath $exeFile -ArgumentList $exeParams -Wait -RedirectStandardOutput $resultFilePath -WindowStyle Hidden
Get-Content $resultFilePath

# updload results to Syncro asset
Upload-File -FilePath $resultFilePath
Remove-Item -Path $resultFilePath -Force

# Remove left over files from program
Remove-Item -Path $zipFile -Force
Remove-Item -Path $exeFile -Force
Remove-Item -Path $mdFile -Force

1 Like

Thanks this works for me appreciate it !!

1 Like

You’re welcome Bob. And a few more characters so I can post this reply.