From 2d5ac335241bcb582a7de8dd86bc1526e88ef158 Mon Sep 17 00:00:00 2001 From: dyoder Date: Sun, 24 May 2020 15:23:48 -0400 Subject: [PATCH] move certificate verification outside try block --- Install-ManagementAgent.ps1 | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Install-ManagementAgent.ps1 b/Install-ManagementAgent.ps1 index 19d63e4..4a73da1 100644 --- a/Install-ManagementAgent.ps1 +++ b/Install-ManagementAgent.ps1 @@ -30,11 +30,8 @@ If ( $CUSTOMER_ID ) } ## Download the agent installer - Try - { - [System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true} - (New-Object System.Net.WebClient).DownloadFile($AGENT_URL, $AGENT_INSTALLER) - } + [System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true} + Try { (New-Object System.Net.WebClient).DownloadFile($AGENT_URL, $AGENT_INSTALLER) } Catch { Write-Output $_.Exception.Message ; Exit } ## Install the agent