This is pretty much a reprint of http://learn.iis.net/page.aspx/491/powershell-snap-in-configuring-ssl-with-the-iis-powershell-snap-in/
1 |
Import-Module WebAdministration<br><br> # Setup Certificate Data<br>$bdate = Get-Date -Format "MM/dd/yyyy"<br>$edate = ([DateTime]::Now).AddYears(50).ToString("MM/dd/yyyy")<br><br>$makecertPath = "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin"<br>$subject = "CN=www.local.mywebsite.com"<br><br>$ipAddress = "127.0.0.7"<br><br># Make the Certificate<br>cd $makecertPath<br>./makecert.exe -r -pe -n "$subject" -b $bdate -e $edate -eku 1.3.6.1.5.5.7.3.1 -ss my -sr localMachine -sky exchange -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12<br><br># Get the Certificate for PowerShell<br>$cert = Get-ChildItem cert:\LocalMachine\My | Where-Object {$_.Subject -eq $subject} | Select-Object -First 1<br>$thumb = $cert.Thumbprint<br><br># Add Certificate to Website<br>Set-Location IIS:\SslBindings<br>Get-Item cert:\LocalMachine\My\$thumb | New-Item $ipAddress!443 |
Resources:
[1] http://msdn.microsoft.com/en-us/library/bfsktky3.aspx (definition of makecert –sp & –sy)
0 comments:
Post a Comment