Add-SSLCertificate

Installs a .pfx file

 

Function Add-SSLCertificate{
param([string]$pfxPath,[string]$pfxPassword,[string]$HostHeader,[string]$Website)

Import-Module "WebAdministration" -ErrorAction Stop
$certMgr = New-Object -ComObject IIS.CertObj -ErrorAction SilentlyContinue
$certMgr.ImportToCertStore($PfxPath,$PfxPassword,$true,$true)

New-WebBinding -Name $Website -Port 443 -Protocol https -HostHeader $HostHeader
}

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top