mirror of
https://github.com/Microsoft/sql-server-samples.git
synced 2025-12-08 14:58:54 +00:00
Stage set-reset-tls.ps1
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
# Enable TLS 1.3 for SQL Server
|
||||
|
||||
[set-reset-tls.ps1](./set-reset-tls.ps1) demonstrates how you can set the registry setting to use specific encryption protocols.
|
||||
|
||||
Learn more at [Transport Layer Security (TLS) registry settings](https://learn.microsoft.com/windows-server/security/tls/tls-registry-settings?tabs=diffie-hellman).
|
||||
@@ -0,0 +1,27 @@
|
||||
# Learn more at https://learn.microsoft.com/en-us/windows-server/security/tls/tls-registry-settings?tabs=diffie-hellman
|
||||
Set-StrictMode -Version Latest
|
||||
|
||||
$base = 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\'
|
||||
$protocols = [ordered]@{
|
||||
"SSL 2.0" = $false
|
||||
"SSL 3.0" = $false
|
||||
"TLS 1.0" = $false
|
||||
"TLS 1.1" = $false
|
||||
"TLS 1.2" = $true
|
||||
"TLS 1.3" = $true
|
||||
}
|
||||
|
||||
foreach ($version in $protocols.Keys) {
|
||||
|
||||
$enabledValue = $protocols[$version]
|
||||
$path = $base + $version + '\Server'
|
||||
|
||||
New-Item $path -Force | Out-Null
|
||||
New-ItemProperty -Path $path `
|
||||
-Name 'Enabled' `
|
||||
-Value $enabledValue `
|
||||
-PropertyType 'DWord' `
|
||||
-Force | Out-Null
|
||||
|
||||
Write-Host "$version is $enabledValue."
|
||||
}
|
||||
Reference in New Issue
Block a user