Forked from tivrobo/EnableTls12ClientForDotNet.ps1
Created
August 24, 2021 02:47
Star
You must be signed in to star a gist
Configure the .NET Framework to support TLS 1.2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# https://docs.microsoft.com/en-us/mem/configmgr/core/plan-design/security/enable-tls-1-2-client#bkmk_net | |
# you need to reboot the OS for the new settings to take effect | |
# | |
function AddRegValue { | |
param ( | |
$Path, | |
$Name, | |
$Value, | |
$Type | |
) | |
if (!(Test-Path $Path)) { | |
New-Item -Path $Path -Force | Out-Null | |
New-ItemProperty -Path $Path -Name $Name -Value $Value -PropertyType $Type -Force | Out-Null | |
} else { | |
New-ItemProperty -Path $Path -Name $Name -Value $Value -PropertyType $Type -Force | Out-Null | |
} | |
} | |
# 32 bit | |
AddRegValue -Path "HKLM:\SOFTWARE\Microsoft\.NETFramework\v2.0.50727" -Name SystemDefaultTlsVersions -Value 1 -Type DWORD | |
AddRegValue -Path "HKLM:\SOFTWARE\Microsoft\.NETFramework\v2.0.50727" -Name SchUseStrongCrypto -Value 1 -Type DWORD | |
AddRegValue -Path "HKLM:\SOFTWARE\Microsoft\.NETFramework\v4.0.30319" -Name SystemDefaultTlsVersions -Value 1 -Type DWORD | |
AddRegValue -Path "HKLM:\SOFTWARE\Microsoft\.NETFramework\v4.0.30319" -Name SchUseStrongCrypto -Value 1 -Type DWORD | |
# 64 bit | |
AddRegValue -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v2.0.50727" -Name SystemDefaultTlsVersions -Value 1 -Type DWORD | |
AddRegValue -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v2.0.50727" -Name SchUseStrongCrypto -Value 1 -Type DWORD | |
AddRegValue -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319" -Name SystemDefaultTlsVersions -Value 1 -Type DWORD | |
AddRegValue -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319" -Name SchUseStrongCrypto -Value 1 -Type DWORD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment