param (
[Parameter(Mandatory=$true)][String]$certpath,
[Parameter(Mandatory=$true)][String]$certpass,
[Parameter(Mandatory=$true)][String]$ip,
[Parameter(Mandatory=$false)][String]$website = "Default Web Site"
)
$mypwd = ConvertTo-SecureString -String $certpass -Force –AsPlainText
$cert = Import-PfxCertificate -FilePath $certpath Cert:\LocalMachine\My -Password $mypwd -Exportable
$bind = Get-WebBinding -Protocol https -IPAddress $ip -port 443
if($bind -ne $null) {
Remove-WebBinding -Protocol https -IPAddress $ip -port 443
}
# -Name $website -IPAddress $ip -Protocol HTTPS -Port 443 -HostHeader '' -Binding $ip':433:'
new-WebBinding -Name $website -IPAddress $ip -Protocol https -Port 443
$bind = Get-WebBinding -Protocol https -IPAddress $ip -port 443
$bind.AddSslCertificate($cert.GetCertHashString(), "my")
This is for a cert to IP without host header.
Tuesday, 4 July 2017
Import and bind a cert is IIS.
Subscribe to:
Comments (Atom)