move certificate verification outside try block

This commit is contained in:
2020-05-24 15:23:48 -04:00
parent 9246e0c6a0
commit 2d5ac33524
+2 -5
View File
@@ -30,11 +30,8 @@ If ( $CUSTOMER_ID )
} }
## Download the agent installer ## Download the agent installer
Try [System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
{ Try { (New-Object System.Net.WebClient).DownloadFile($AGENT_URL, $AGENT_INSTALLER) }
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
(New-Object System.Net.WebClient).DownloadFile($AGENT_URL, $AGENT_INSTALLER)
}
Catch { Write-Output $_.Exception.Message ; Exit } Catch { Write-Output $_.Exception.Message ; Exit }
## Install the agent ## Install the agent