首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >绑定后向网站分配SSL证书- Powershell

绑定后向网站分配SSL证书- Powershell
EN

Stack Overflow用户
提问于 2017-01-24 01:35:09
回答 1查看 756关注 0票数 0

日安。在与http和https绑定之后,如何将SSL证书自动分配到网站?

我有这段代码,它绑定了http和https,但是它没有分配SSL证书。也许你能帮我。提前谢谢你。

代码语言:javascript
复制
 $thumbprint="########################################"
 $binding = @{protocol="http";bindingInformation=$ip+":80:"+$iisAppNameBinding}
 new-item $iisAppName -type site –physicalPath $directoryPath -bindings $binding

 $newBinding = (
      @{protocol="http";bindingInformation=$ip+":80:"+$iisAppNameBinding},
      @{protocol="https";bindingInformation=$ip+":443:"+$iisAppNameBinding;certificateStoreName="MY";certificateName=$thumbprint})
 Set-itemproperty $iisAppName -name bindings -value $newBinding
EN

回答 1

Stack Overflow用户

发布于 2017-01-24 12:12:04

假设您的证书在证书下:LocalMachine\My

代码语言:javascript
复制
import-module webadministration
$computerName = $Env:Computername
$domainName = $Env:UserDnsDomain
New-WebBinding -Name "MyWebSite" -IP "*" -Port 443 -Protocol https
Get-ChildItem cert:\LocalMachine\My | where { $_.Subject -match "CN\=$Computername\.$DomainName" } | select -First 1 | New-Item IIS:\SslBindings\0.0.0.0!443

另一种方法的参考链接:powershell-快速配置-ssl

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41818623

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档