'Binding SSL Cert to Port Using PowerShell
$Thumbprint = (Get-ChildItem -Path Cert:\LocalMachine\My | Where-Object {$_.Subject -match "CN=appserver.domain.com"}).Thumbprint;
$guid = [guid]::NewGuid()
$certHash = $thumbprint
$ip = "0.0.0.0" # This means all IP addresses
$port = "8280" # the default HTTPS port
"http add sslcert ipport=$($ip):$port certhash=$Thumbprint appid={$guid}" | netsh
I got this from a search online, but it doesn't work. The entry isn't created when I run it. I'm checking with netsh http show sslcert and nothing is there.
Solution 1:[1]
If you have PowerShell 4.0+ you can use Add-NetIPHttpsCertBinding
Docs + Example https://technet.microsoft.com/itpro/powershell/windows/networktransition/add-netiphttpscertbinding
Solution 2:[2]
Add-NetIPHttpsCertBinding does not work on Windows 7, but this did:
$params_add = "netsh http add sslcert ipport=0.0.0.0:443 certhash=$Thumbprint appid={aedae042-2b80-475d-861b-8f8c5d876098}"
cmd.exe /c $params_add --%
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | BrockG |
| Solution 2 | MGOwen |
