major change to override Write-Error func
This commit is contained in:
@@ -9,18 +9,18 @@ $WORKINGDIR = $ZIPFILE.Substring(0, $ZIPFILE.LastIndexOf('.'))
|
||||
If ( Test-Path $WORKINGDIR ) {
|
||||
Write-Output "Deleting existing directory: ""$WORKINGDIR"""
|
||||
Try { Remove-Item -Path $WORKINGDIR -Recurse -Force }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
Catch { Write-Error $_.Exception.Message }
|
||||
}
|
||||
Write-Output "Creating new directory: ""$WORKINGDIR"""
|
||||
Try { New-Item -Path $WORKINGDIR -ItemType Directory -Force | Out-Null }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
Catch { Write-Error $_.Exception.Message }
|
||||
|
||||
## Extract $ZIPFILE to $WORKINGDIR
|
||||
Try {
|
||||
Add-Type -Assembly System.IO.Compression.FileSystem
|
||||
[IO.Compression.ZipFile]::ExtractToDirectory($ZIPFILE, $WORKINGDIR)
|
||||
}
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
Catch { Write-Error $_.Exception.Message }
|
||||
|
||||
## Run the SpeedTest CLI app
|
||||
$SPEEDTEST = "${WORKINGDIR}\speedtest.exe"
|
||||
@@ -44,7 +44,7 @@ If ( Test-Path $SPEEDTEST ) {
|
||||
Write-Output $RESULTS
|
||||
Write-Output "Finished internet bandwidth test"
|
||||
}
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
Catch { Write-Error $_.Exception.Message }
|
||||
|
||||
} Else { Write-Output "The file does not exist at the expected path: ""${SPEEDTEST}""" }
|
||||
|
||||
@@ -52,11 +52,11 @@ If ( Test-Path $SPEEDTEST ) {
|
||||
If ( Test-Path $ZIPFILE ) {
|
||||
Write-Output "Deleting downloaded zip file: ""$ZIPFILE"""
|
||||
Try { Remove-Item -Path $ZIPFILE -Force }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
Catch { Write-Error $_.Exception.Message }
|
||||
} Else { Write-Output "Downloaded zip file no longer exists: ""$ZIPFILE""" }
|
||||
|
||||
If ( Test-Path $WORKINGDIR ) {
|
||||
Write-Output "Deleting directory from extracted zip file: ""$WORKINGDIR"""
|
||||
Try { Remove-Item -Path $WORKINGDIR -Recurse -Force }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
Catch { Write-Error $_.Exception.Message }
|
||||
} Else { Write-Output "Directory from extracted zip file no longer exists: ""$WORKINGDIR""" }
|
||||
Reference in New Issue
Block a user