使用PowerShell将SSL证书绑定到端口

时间:2017-03-30 07:57:30

标签: 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

我是通过在线搜索得到的,但它不起作用。我运行它时不会创建该条目。我正在检查netsh http show sslcert并且没有任何内容。

1 个答案:

答案 0 :(得分:2)

如果您有PowerShell 4.0+,则可以使用Add-NetIPHttpsCertBinding

文档+示例https://technet.microsoft.com/itpro/powershell/windows/networktransition/add-netiphttpscertbinding