Guard TLS 1.3 protocol assignment with try/catch fallback to TLS 1.2

This commit is contained in:
Patrick Asmus
2026-07-06 12:17:24 +02:00
parent 6e1ca3e1c2
commit 861315c5bc

View File

@@ -9,9 +9,9 @@ Author: Patrick Asmus
Web: https://www.cleveradmin.de
Repository: https://git.techniverse.net/scriptos/windows-updater.git
License: MIT
Version: 2.7.0
Version: 2.7.1
Date: 06.07.2026
Modifications: Prefer TLS 1.3 with TLS 1.2 fallback for improved security
Modifications: Guard TLS 1.3 protocol assignment with try/catch fallback to TLS 1.2
#####################################################
#>
@@ -24,7 +24,11 @@ if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdenti
exit 1
}
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls13 -bor [Net.SecurityProtocolType]::Tls12
try {
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls13 -bor [Net.SecurityProtocolType]::Tls12
} catch {
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
}
#endregion