update error reporting

This commit is contained in:
2020-05-24 15:20:28 -04:00
parent 3d6b8700bd
commit 9246e0c6a0
+4 -4
View File
@@ -26,7 +26,7 @@ If ( $CUSTOMER_ID )
If ( Test-Path $AGENT_INSTALLER )
{
Try { Remove-Item $AGENT_INSTALLER -Force }
Catch { Write-Output "The agent installer already exists but there was an error when trying to delete it!" }
Catch { Write-Output $_.Exception.Message }
}
## Download the agent installer
@@ -35,17 +35,17 @@ If ( $CUSTOMER_ID )
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
(New-Object System.Net.WebClient).DownloadFile($AGENT_URL, $AGENT_INSTALLER)
}
Catch { Write-Output "There was an error downloading the agent installer!" }
Catch { Write-Output $_.Exception.Message ; Exit }
## Install the agent
Try { Start-Process $AGENT_INSTALLER -ArgumentList '/quiet /passive' -Wait }
Catch { Write-Output "There was an error installing the agent!" }
Catch { Write-Output $_.Exception.Message }
## Remove the agent installer
If ( Test-Path $AGENT_INSTALLER )
{
Try { Remove-Item -Path $AGENT_INSTALLER -Force }
Catch { Write-Output "There was an error while deleting the agent installer!" }
Catch { Write-Output $_.Exception.Message }
}
} Else { Write-Output "The agent is already installed on this endpoint." }
} Else { Write-Output "No CUSTOMER_ID was specified!" }