Guard TLS 1.3 with enum check and try/catch fallback to TLS 1.2
This commit is contained in:
@@ -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.1
|
||||
Version: 2.7.2
|
||||
Date: 06.07.2026
|
||||
Modifications: Guard TLS 1.3 protocol assignment with try/catch fallback to TLS 1.2
|
||||
Modifications: Guard TLS 1.3 with enum check and try/catch fallback to TLS 1.2
|
||||
#####################################################
|
||||
#>
|
||||
|
||||
@@ -25,8 +25,14 @@ if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdenti
|
||||
}
|
||||
|
||||
try {
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls13 -bor [Net.SecurityProtocolType]::Tls12
|
||||
} catch {
|
||||
if ([enum]::GetNames([Net.SecurityProtocolType]) -contains 'Tls13') {
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls13 -bor [Net.SecurityProtocolType]::Tls12
|
||||
}
|
||||
else {
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
}
|
||||
}
|
||||
catch {
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user