2014-02-05 14 views
7

Ich muss ein neues selbstsigniertes IIS SSL-Zertifikat von einem PowerShell-Skript als Teil einer automatisierten Installation erstellen.Erstellen Sie selbst signierte IIS SSL-Zertifikat von Powershell

Hier ist, was ich versucht habe:

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 

Ergebnis

Es sagt New-SelfSignedCertificate kann für diese Zeile nicht gefunden werden. Wenn ich das Zertifikat manuell über den IIS-Manager erstelle, funktioniert der Rest des Codes einwandfrei.

Danke für Ihre Hilfe!

+1

Von [diesem Beitrag] (http://stackoverflow.com/questions/12463297/using-powershell-to-create-self-signed-certificate zu arbeiten? rq = 1) ist [ein Link zu einem TechNet-Artikel] (http://social.technet.microsoft.com/wiki/contents/articles/16226.quick-start-guide-for-integrating-a-single-forest- local-active-directory-with-windows-azure-ad.aspx), die Ihnen dabei helfen können. – admdrew

Antwort

10

Ich habe es auf diese Weise

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!443 
+0

Für alle, die auf diese Lösung stoßen, müssen Sie zuerst das WebAdministration-Modul importieren, also "Import-Module WebAdministration" gefolgt von "Set-Location IIS: \ SslBindings" – northerncodemonkey

Verwandte Themen