From a47a60f37d0a1d72a89e3194a5782ceb8a320cd0 Mon Sep 17 00:00:00 2001 From: HomeSen Date: Thu, 6 Feb 2020 17:51:04 +0100 Subject: [PATCH] Fix Powershell SSL/TLS error for chocolatey download --- packer/templates/windows_2008_r2.json | 2 +- scripts/installs/install_chocolatey.ps1 | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packer/templates/windows_2008_r2.json b/packer/templates/windows_2008_r2.json index f3814c2..27dffbc 100644 --- a/packer/templates/windows_2008_r2.json +++ b/packer/templates/windows_2008_r2.json @@ -185,7 +185,7 @@ { "type": "powershell", "inline": [ - "$env:chocolateyVersion = '0.10.8'; iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" + "$env:chocolateyVersion = '0.10.8'; [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" ], "pause_before": "60s" }, diff --git a/scripts/installs/install_chocolatey.ps1 b/scripts/installs/install_chocolatey.ps1 index c726122..5065bda 100644 --- a/scripts/installs/install_chocolatey.ps1 +++ b/scripts/installs/install_chocolatey.ps1 @@ -1,5 +1,6 @@ $ChocoInstallPath = "$env:SystemDrive\ProgramData\Chocolatey\bin" if (!(Test-Path $ChocoInstallPath)) { + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) } \ No newline at end of file