作为自动安装的一部分,我需要从PowerShell脚本创建一个新的自签名IIS证书。
,这是我尝试过的:
Import-Module WebAdministation
New-WebBinding -Name "Default Web Site" -IP "*" -Port 443 -Protocol https
New-SelfSignedCertificate -Subject Fluency -DnsName $computerName.$domainName -CertStoreLocation cert:\LocalMachine\My
Get-ChildItem cert:\LocalMachine\My | where { $_.Subject -match "CN\=$Computername\.$DomainName" } | select -First 1 | New-Item IIS:\SslBindings\0.0.0.0!443结果
它说在该行中找不到New。如果我通过IIS管理器手动创建证书,则其余代码工作正常。
谢谢你的帮忙!
发布于 2014-04-10 16:23:05
我把它弄成这样
Import-Module WebAdministration
Set-Location IIS:\SslBindings
New-WebBinding -Name "Default Web Site" -IP "*" -Port 443 -Protocol https
$c = New-SelfSignedCertificate -DnsName "myexample.com" -CertStoreLocation cert:\LocalMachine\My
$c | New-Item 0.0.0.0!443https://stackoverflow.com/questions/21584870
复制相似问题