Volete sapere quanto tempo impiegate a scaricare un file e quale è a velocità media del download? PowerShell li calcola al vostro posto. Lo script non è applicabile a tutti i tipi di download, dovete avere il link diretto del file da scaricare.

Avvertenza: Non sono io l'autore degli script, mi sono limitato cercare sul Web e raccogliere quelli funzionanti e più interessanti.
Invoke-WebRequest
In questo script potete modificare il link del file da scaricare ($FILE) e il nome del file e la cartella di destinazione ($DEST).
# 1. Inserire indirizzo file da scaricare$FILE = 'https://releases.ubuntu.com/22.04.3/ubuntu-22.04.3-desktop-amd64.iso'$DEST = 'd:\ubuntu-22.04.3-desktop-amd64.iso'"Download del file [$FILE]""Salvatagio file in [$DEST]"# 2. Tempo del download$Start = Get-DateInvoke-WebRequest -Uri $FILE -OutFile $DEST$End = Get-Date# 3. Calcolo del tempo impiegato$TimeTaken = $End-$Start# 4. Visualizza il tempo impiegato$Seconds = $TimeTaken.TotalSeconds"Totale secondi impiegati per completare il download [$($TimeTaken.TotalSeconds)]"# 5. Calcola la velocità$Size = (Get-ChildItem -Path $DEST).Length$Speed = ($Size/$Seconds).ToString('N2')# 6. Visualizza la velocità media"Velocità download (bytes/secondi) [$Speed]"

Start-BitsTransfer
Una versione leggermente diversa dello script appena visto, che sfrutta il BitsTransfer per scaricare il file, il download del file è leggermente più lento rispetto a un download fatto con Invoke-WebRequest.
Anche in questo script potete modificare il link del file da scaricare ($FILE) e il nome del file e la cartella di destinazione ($DEST).
# 1. Defining the file to be tested$FILE = 'https://endpoint920510.azureedge.net/s4l/s4l/download/win/Skype-8.106.0.210.exe'$DEST = 'd:\skype.exe'"Testing a download of [$FILE]""Storing at [$DEST]"# 2. Timing the download$Start = Get-DateStart-BitsTransfer -Source $FILE -Destination $DEST$End = Get-Date# 3. Calculating the time taken$TimeTaken = $End-$Start# 4. Displaying time taken$Seconds = $TimeTaken.TotalSeconds"Total seconds taken to perform download [$($TimeTaken.TotalSeconds)"# 5. Calculate bytes/sec$Size = (Get-ChildItem -Path $DEST).Length$Speed = ($Size/$Seconds).ToString('N2')# 6. Display the speed achieved"Download speed (bytes/second) [$Speed]"

Questo script mostra solo una barra del progresso del download, non ne calcola il tempo e al termine si chiude.
$startBitsTransferSplat = @{Source = ' https://endpoint920510.azureedge.net/s4l/s4l/download/win/Skype-8.106.0.210.exe 'Destination = 'd:\skype.exe'}Start-BitsTransfer @startBitsTransferSplat

Simile al precedente script, ma in questa versione mostra il tempo impiegato dal download.
$stopwatch = [System.Diagnostics.Stopwatch]::new()$stopwatch.Start()$startBitsTransferSplat = @{ Source = 'https://endpoint920510.azureedge.net/s4l/s4l/download/win/Skype-8.106.0.210.exe'Destination = 'd:\skype.exe'}Start-BitsTransfer @startBitsTransferSplat$stopwatch.Stop() Write-Output $stopwatch.Elapsed

Media dei tempi
Questo script calcola la media dei tempi ripetendo il download più volte, basta modificare il valore di $iterationNumber, togliendo il cancelletto, dalla riga # $ProgressPreference = 'SilentlyContinue', si può nascondere la barra di progressione del download. Questa è più una simulazione del download, perché salva il file nella cartella Temp e poi lo va a eliminare.
# Changing the progress preference to hide the progress bar.# $ProgressPreference = 'SilentlyContinue'$payloadUrl = 'https://endpoint920510.azureedge.net/s4l/s4l/download/win/Skype-8.106.0.210.exe'$stopwatch = New-Object -TypeName 'System.Diagnostics.Stopwatch'$elapsedTime = [timespan]::Zero$iterationNumber = 3# Here we are using a foreach loop with a range,# but this can also be accomplished with a for loop.foreach ($iteration in 1..$iterationNumber) {$tempFilePath = [System.IO.Path]::GetTempFileName()$stopwatch.Restart()Start-BitsTransfer -Source $payloadUrl -Destination $tempFilePath$stopwatch.Stop()Remove-Item -Path $tempFilePath$elapsedTime = $elapsedTime.Add($stopwatch.Elapsed)}# Timespan.Divide is not available on .NET Framework.if ($PSVersionTable.PSVersion -ge [version]'6.0') {$average = $elapsedTime.Divide($IterationNumber)} else { $average = [timespan]::new($elapsedTime.Ticks / $IterationNumber)}return $average