Skip to content

Instantly share code, notes, and snippets.

@rheid
Created February 23, 2016 21:29
Show Gist options
  • Save rheid/35e6f1af14248b82755b to your computer and use it in GitHub Desktop.
Save rheid/35e6f1af14248b82755b to your computer and use it in GitHub Desktop.
Add the matching IIS certificate to website and active SNI
$Path = "cert:\localmachine\my"
$Certs = Get-ChildItem -path $Path
foreach ($cert in $Certs)
{
#Get Folder-Informationen form Filessystem
$loop = $loop + 1;
foreach ($name in $cert.DnsNameList)
{
Write-Host $name -ForegroundColor Green
New-WebBinding -Name $name -IP "*" -Port 443 -Protocol https -HostHeader $name -SslFlags 1
$iisPath = "IIS:\SslBindings\!443!" + $name
New-Item -Path $iisPath -Value $cert -SSLFlags 1
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment