Skip to content

Instantly share code, notes, and snippets.

@nvnivs
Created October 30, 2014 11:22
Show Gist options
  • Save nvnivs/8863e8043d46dd026ab8 to your computer and use it in GitHub Desktop.
Save nvnivs/8863e8043d46dd026ab8 to your computer and use it in GitHub Desktop.
Disables SSL v2 protocol on IIS
<#
.SYNOPSIS
Disables SSL v2 protocol on IIS
#>
function Create-SubKey {
param(
[parameter(position=0)]$path,
[parameter(position=1)]$key,
[parameter(position=2)]$subKey
)
if (!(Test-Path "$path\$key\$subKey")) {
(Get-Item $path).OpenSubKey($key, $true).CreateSubKey($subKey) | Out-Null
Write-Output "$path\$key\$subKey"
}
}
function Update-RegistryProperty {
param(
[parameter(position=0)]$path,
[parameter(position=1)]$key,
[parameter(position=2)]$value,
[parameter(position=3)]$type
)
$property = Get-Item $path | Get-ItemProperty | Select-Object -ExpandProperty $key -ea:silentlyContinue
if ($property -eq $null) {
New-ItemProperty -path $path -name $key -value $value -PropertyType $type | Out-Null
Write-Output "Created property $path[$key] = $value"
}
else {
if ($property -ne $value) {
Set-ItemProperty -path $path -name $key -value $value | Out-Null
Write-Output "Updated property $path[$key] = $value"
}
}
}
$ErrorActionPreference = "Stop"
$schannelPath = "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL"
Create-SubKey "$schannelPath" "Protocols" "SSL 2.0"
Create-SubKey "$schannelPath\Protocols" "SSL 2.0" "Server"
Update-RegistryProperty "$schannelPath\Protocols\SSL 2.0\Server" "Enabled" "0" "Dword"
Write-Output 'SSL 2.0 disabled'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment