major update to override Write-Output func
This commit is contained in:
+10
-10
@@ -7,11 +7,11 @@ $ZIPFILE = Download-File -URL $URL
|
||||
## Setup the directory to extract the downloaded zip file to
|
||||
$WORKINGDIR = $ZIPFILE.Substring(0, $ZIPFILE.LastIndexOf('.'))
|
||||
If ( Test-Path $WORKINGDIR ) {
|
||||
LogMsg "Deleting existing directory: ""$WORKINGDIR"""
|
||||
Write-Output "Deleting existing directory: ""$WORKINGDIR"""
|
||||
Try { Remove-Item -Path $WORKINGDIR -Recurse -Force }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
}
|
||||
LogMsg "Creating new directory: ""$WORKINGDIR"""
|
||||
Write-Output "Creating new directory: ""$WORKINGDIR"""
|
||||
Try { New-Item -Path $WORKINGDIR -ItemType Directory -Force | Out-Null }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
|
||||
@@ -27,7 +27,7 @@ $SPEEDTEST = "${WORKINGDIR}\speedtest.exe"
|
||||
If ( Test-Path $SPEEDTEST ) {
|
||||
Try {
|
||||
|
||||
LogMsg "Starting internet bandwidth test"
|
||||
Write-Output "Starting internet bandwidth test"
|
||||
$RESULTS = [string]( cmd.exe /c ""${SPEEDTEST} --accept-license --progress=no"" )
|
||||
|
||||
## Cleanup the output
|
||||
@@ -41,22 +41,22 @@ If ( Test-Path $SPEEDTEST ) {
|
||||
$RESULTS = $RESULTS -replace "Result URL: ", "`nResult URL: "
|
||||
$RESULTS = $RESULTS + "`n"
|
||||
} Else { $RESULTS = "The test did not product any output" }
|
||||
LogMsg $RESULTS
|
||||
LogMsg "Finished internet bandwidth test"
|
||||
Write-Output $RESULTS
|
||||
Write-Output "Finished internet bandwidth test"
|
||||
}
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
|
||||
} Else { LogMsg "The file does not exist at the expected path: ""${SPEEDTEST}""" }
|
||||
} Else { Write-Output "The file does not exist at the expected path: ""${SPEEDTEST}""" }
|
||||
|
||||
## Cleanup files and directories created by this script
|
||||
If ( Test-Path $ZIPFILE ) {
|
||||
LogMsg "Deleting downloaded zip file: ""$ZIPFILE"""
|
||||
Write-Output "Deleting downloaded zip file: ""$ZIPFILE"""
|
||||
Try { Remove-Item -Path $ZIPFILE -Force }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
} Else { LogMsg "Downloaded zip file no longer exists: ""$ZIPFILE""" }
|
||||
} Else { Write-Output "Downloaded zip file no longer exists: ""$ZIPFILE""" }
|
||||
|
||||
If ( Test-Path $WORKINGDIR ) {
|
||||
LogMsg "Deleting directory from extracted zip file: ""$WORKINGDIR"""
|
||||
Write-Output "Deleting directory from extracted zip file: ""$WORKINGDIR"""
|
||||
Try { Remove-Item -Path $WORKINGDIR -Recurse -Force }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
} Else { LogMsg "Directory from extracted zip file no longer exists: ""$WORKINGDIR""" }
|
||||
} Else { Write-Output "Directory from extracted zip file no longer exists: ""$WORKINGDIR""" }
|
||||
Reference in New Issue
Block a user