Powershell IIS7 Snap in Assign SSL certificate to https binding

后端 未结 4 2032
余生分开走
余生分开走 2021-01-11 15:29

As part of our automated build procedure we are trashing and reconstructing our IIS site with powershell scripts.

Once i have created the AppPool and the website com

4条回答
  •  甜味超标
    2021-01-11 15:44

    You can merge previous examples with creation of an https binding in a web site.

    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
    

提交回复
热议问题