From 3c13be52b15fe44974385ce89744c16b06056376 Mon Sep 17 00:00:00 2001 From: robinvervoort <72465676+robinvervoort@users.noreply.github.com> Date: Fri, 23 Oct 2020 13:35:47 +0200 Subject: [PATCH] Force TLS1.2 Added a step in front of install-packageprovider NuGet to force TLS1.2. In some cases it fails to find the packageprovider for NuGet if it's not forced. --- Invoke-CMApplyDriverPackage.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Invoke-CMApplyDriverPackage.ps1 b/Invoke-CMApplyDriverPackage.ps1 index 9ecbc52..2ead903 100644 --- a/Invoke-CMApplyDriverPackage.ps1 +++ b/Invoke-CMApplyDriverPackage.ps1 @@ -785,6 +785,10 @@ Process { catch [System.Exception] { Write-CMLogEntry -Value " - Unable to detect PSIntuneAuth module, attempting to install from PSGallery" -Severity 2 try { + #Force TLS1.2 + Write-CMLogEntry -Value " - Setting security protocol to TLS1.2" -Severity 1 + [Net.servicepointmanager]::securityprotocol = [Net.securityProtocolType]::Tls12 + # Install NuGet package provider $PackageProvider = Install-PackageProvider -Name "NuGet" -Force -Verbose:$false