update to log to standard log file
This commit is contained in:
@@ -1,10 +1,7 @@
|
||||
. 'C:\Users\dyoder\Documents\Emberkom\Data\Projects\development\management-scripts\Tools.ps1'
|
||||
## Specify URL to SpeedTest CLI app
|
||||
$URL = 'https://install.speedtest.net/app/cli/ookla-speedtest-1.0.0-win64.zip'
|
||||
|
||||
## Specify output file to write data to
|
||||
$CurrentDateTime = Get-Date -Format "yyyyMMddHHmmssffff"
|
||||
$OUTPUT = "${OutputDirectory}\${CurrentDateTime}_SpeedTest.csv"
|
||||
|
||||
## Download the app from the URL
|
||||
$ZIPFILE = Download-File -URL $URL
|
||||
|
||||
@@ -21,7 +18,7 @@ Catch { LogErr $_.Exception.Message }
|
||||
|
||||
## Extract $ZIPFILE to $WORKINGDIR
|
||||
Try {
|
||||
Add-Type -Assembly �System.IO.Compression.FileSystem�
|
||||
Add-Type -Assembly System.IO.Compression.FileSystem
|
||||
[IO.Compression.ZipFile]::ExtractToDirectory($ZIPFILE, $WORKINGDIR)
|
||||
}
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
@@ -29,12 +26,27 @@ Catch { LogErr $_.Exception.Message }
|
||||
## Run the SpeedTest CLI app
|
||||
$SPEEDTEST = "${WORKINGDIR}\speedtest.exe"
|
||||
If ( Test-Path $SPEEDTEST ) {
|
||||
#Try { Start-Process $SPEEDTEST -ArgumentList "--progress=no --selection-details --output-header --format=csv" -PassThru -Wait -RedirectStandardOutput $OUTPUT }
|
||||
Try {
|
||||
$RESULTS = (cmd.exe /c "${SPEEDTEST} --progress=no")
|
||||
$RESULTS = [string]( cmd.exe /c ""${SPEEDTEST} --accept-license --progress=no"" )
|
||||
|
||||
## Cleanup the output
|
||||
If ( -not [string]::IsNullOrEmpty($RESULTS) ) {
|
||||
$RESULTS = $RESULTS -replace "Server: ", "`n`nServer: "
|
||||
$RESULTS = $RESULTS -replace "ISP: ", "`nISP: "
|
||||
$RESULTS = $RESULTS -replace "Latency: ", "`nLatency: "
|
||||
$RESULTS = $RESULTS -replace "Download: ", "`nDownload: "
|
||||
$RESULTS = $RESULTS -replace "Upload: ", "`nUpload: "
|
||||
$RESULTS = $RESULTS -replace "Packet Loss: ", "`nPacket Loss: "
|
||||
$RESULTS = $RESULTS -replace "Result URL: ", "`nResult URL: "
|
||||
$RESULTS = $RESULTS + "`n"
|
||||
} Else { $RESULTS = "The test did not product any output" }
|
||||
LogMsg $RESULTS
|
||||
}
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
|
||||
## Wait 5 seconds before continuing so the test has a chance to start before it gets deleted
|
||||
Start-Sleep -Seconds 5
|
||||
|
||||
} Else { LogMsg "The file does not exist at the expected path: ""${SPEEDTEST}""" }
|
||||
|
||||
## Cleanup files and directories created by this script
|
||||
|
||||
Reference in New Issue
Block a user