This is Windows Server 2012 with IIS 8.5 (yes, it is old, no I can’t just use something newer) I’ve basically figured out how to create the SSL Certificate and Web Bindings, but I’m experiencing a peculiar behavior.
So, when I do the following ($fqdn is populated earlier):
$cert = (New-SelfSignedCertificate -DnsName “$fqdn” -CertStoreLocation cert:\LocalMachine\My).Thumbprint
New-WebBinding -Name “Web_Tools” -Protocol https -IP “*” -Port 443
$bind = Get-WebBinding -Name “Web_Tools” -Protocol https
$bind.AddSslCertificate($cert, “My”)
Everything appears to work, and when I go to IIS Manager I can see everything is set up correctly. However when I try to do:
Get-ChildItem -Path IIS:\SSLBindings
I see nothing. I have tried the following:
- "iisreset /restart"
- 'Stop-Website -Name "Web_Tools"; Start-Website -Name "Web_Tools"'
- Stopping and Starting World Wide Web Publishing Service from the Service Control Panel.
- IIS Manager\Web_Tools\Manage Website Stop button followed by the Start button.
The goal is to be able to verify that the ‘AddSslCertificate’ step actually worked and to be able to check whether it was already done previously if the script gets run again.
I’m not necessarily tied to this method of doing things, as long as I can enable SSL for the “Web_Tools” website specifically since it has a specific CGI configuration that is separate from the default website.
Any insight or suggestions would be appreciated. Thank you in advance for your time.
-Jay