Created
January 27, 2019 03:07
-
-
Save gavi/8902e3c7e432cf8144ea145e5ce32edb to your computer and use it in GitHub Desktop.
Bind SSL on Windows to a specific IP address and Certificate Thumbprint
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function AddSSLBinding($fqdn,$ip,$thumbprint){ | |
$cert = Get-ChildItem Cert:\LocalMachine\My\$($thumbprint) | |
New-WebBinding -Name $fqdn -IPAddress "$($ip)" -Port 443 -Protocol "https" -HostHeader $fqdn | |
$bind = Get-WebBinding -Name $fqdn -Protocol https | |
$bind.AddSslCertificate($cert.GetCertHashString(), "my") | |
} | |
#Usage Example | |
AddSSLBinding "test.domain.com" "10.0.0.1" "12344979A469750712B5EAC6168D85EC02E053FC" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment