From 3e0839c677935d8e5e501c2c621477e245189204 Mon Sep 17 00:00:00 2001 From: robmoss2k <15984835+robmoss2k@users.noreply.github.com> Date: Tue, 10 Dec 2024 16:22:43 +0000 Subject: [PATCH] Update security protocol handling in test_all.ps1 for PowerShell 6+ --- test_all.ps1 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test_all.ps1 b/test_all.ps1 index 37fe06730ac..163dc4d40ba 100644 --- a/test_all.ps1 +++ b/test_all.ps1 @@ -75,10 +75,14 @@ $options = [ordered]@{ } } -[System.Net.ServicePointManager]::SecurityProtocol = 3072 -bor - 768 -bor - [System.Net.SecurityProtocolType]::Tls -bor - [System.Net.SecurityProtocolType]::Ssl3 +# https://github.com/majkinetor/au/issues/142 + +if ($PSVersionTable.PSVersion.major -ge 6) { + $AvailableTls = [enum]::GetValues('Net.SecurityProtocolType') | Where-Object { $_ -ge 'Tls' } # PowerShell 6+ does not support SSL3, so use TLS minimum + $AvailableTls.ForEach({[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor $_}) +} else { + [System.Net.ServicePointManager]::SecurityProtocol = 3072 -bor 768 -bor [System.Net.SecurityProtocolType]::Tls -bor [System.Net.SecurityProtocolType]::Ssl3 +} $global:info = updateall -Name $Name -Options $Options