Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save joyvinci/6779bb5935574972b4ca5e6bcb1006fa to your computer and use it in GitHub Desktop.
Save joyvinci/6779bb5935574972b4ca5e6bcb1006fa to your computer and use it in GitHub Desktop.
Configure the .NET Framework to support TLS 1.2
#
# 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