Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
64e4ca1237 | ||
|
|
64af4da861 |
@@ -1,3 +1,4 @@
|
|||||||
|
. 'C:\Users\dyoder\Documents\Emberkom\Data\Projects\development\management-scripts\Tools.ps1'
|
||||||
## Specify URL to SpeedTest CLI app
|
## Specify URL to SpeedTest CLI app
|
||||||
$URL = 'https://install.speedtest.net/app/cli/ookla-speedtest-1.0.0-win64.zip'
|
$URL = 'https://install.speedtest.net/app/cli/ookla-speedtest-1.0.0-win64.zip'
|
||||||
|
|
||||||
@@ -26,6 +27,8 @@ Catch { LogErr $_.Exception.Message }
|
|||||||
$SPEEDTEST = "${WORKINGDIR}\speedtest.exe"
|
$SPEEDTEST = "${WORKINGDIR}\speedtest.exe"
|
||||||
If ( Test-Path $SPEEDTEST ) {
|
If ( Test-Path $SPEEDTEST ) {
|
||||||
Try {
|
Try {
|
||||||
|
|
||||||
|
LogMsg "Starting internet bandwidth test"
|
||||||
$RESULTS = [string]( cmd.exe /c ""${SPEEDTEST} --accept-license --progress=no"" )
|
$RESULTS = [string]( cmd.exe /c ""${SPEEDTEST} --accept-license --progress=no"" )
|
||||||
|
|
||||||
## Cleanup the output
|
## Cleanup the output
|
||||||
@@ -40,12 +43,10 @@ If ( Test-Path $SPEEDTEST ) {
|
|||||||
$RESULTS = $RESULTS + "`n"
|
$RESULTS = $RESULTS + "`n"
|
||||||
} Else { $RESULTS = "The test did not product any output" }
|
} Else { $RESULTS = "The test did not product any output" }
|
||||||
LogMsg $RESULTS
|
LogMsg $RESULTS
|
||||||
|
LogMsg "Finished internet bandwidth test"
|
||||||
}
|
}
|
||||||
Catch { LogErr $_.Exception.Message }
|
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}""" }
|
} Else { LogMsg "The file does not exist at the expected path: ""${SPEEDTEST}""" }
|
||||||
|
|
||||||
## Cleanup files and directories created by this script
|
## Cleanup files and directories created by this script
|
||||||
|
|||||||
@@ -149,9 +149,14 @@ Function Run-Script {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$LogFileContent = (Get-Content $LogFile)
|
||||||
|
|
||||||
## Write the log file output to the console
|
## Write the log file output to the console
|
||||||
If ( Test-Path $LogFile ) { Get-Content -Path $LogFile | Write-Output }
|
If ( $LogFileContent ) { Write-Output $LogFileContent }
|
||||||
Else { Write-Output "Log file not found at ""$LogFile""" }
|
|
||||||
|
## Delete the log file if it's empty
|
||||||
|
Else { Remove-Item $LogFile -Force }
|
||||||
}
|
}
|
||||||
|
|
||||||
## Return a Powershell version object from a string
|
## Return a Powershell version object from a string
|
||||||
|
|||||||
Reference in New Issue
Block a user