ps/Modules/Alkami.PowerShell.Configuration/Public/Set-DefaultTLSVersion.ps1
2023-05-30 22:51:22 -07:00

25 lines
862 B
PowerShell

function Set-DefaultTLSVersion {
<#
.SYNOPSIS
Adds registry keys that set .NET to use TLS 1.2 by default
#>
[CmdletBinding()]
Param()
$logLead = (Get-LogLeadName);
$baseKey = "HKLM:\SOFTWARE\Microsoft\.NETFramework\v4.0.30319"
$base86Key = "HKLM:\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319"
$tlsSetting = "SystemDefaultTlsVersions"
$tlsDWord = 1
Write-Output ("$logLead : Adding setting {0} to key {1} with value {2}" -f $tlsSetting, $baseKey, $tlsDWord)
Set-ItemProperty -Path $baseKey -Name "$tlsSetting" -Value $tlsDWord -ErrorAction SilentlyContinue | Out-Null
Write-Output ("$logLead : Adding setting {0} to key {1} with value {2}" -f $tlsSetting, $base86Key, $tlsDWord)
Set-ItemProperty -Path $base86Key -Name "$tlsSetting" -Value $tlsDWord -ErrorAction SilentlyContinue | Out-Null
}