I have a server with a dozen or so sites that each have HTTP and HTTPS bindings, with a couple of these sites sharing the same root domain, like so:
Name Bindings
---- --
Site 1 www.contoso.com:80
www.contoso.com:443
Site 2 foobar.contoso.com:80
foobar.contoso.com:443
Site 3 www.example.com:80
www.example.com:443
etc.
Now, the SSL certificate I use, *.contoso.com, is expiring next week, so I got a new one, imported it and it is now available to IIS. To replace the certificate for each binding using the old one I now have to go to each site, go to bindings, select the :443
binding and set it to use the new certificate. Not a big issue with just one site, but I have dozens of sites all running on this certificate!
How can I easily switch all the *.contoso.com sites from the old certificate to the new one using Powershell?
I have already looked into the documentation of the IISAdministration
module but I haven't been successful in finding a method that allows me to change a binding so that it uses a different certificate, and google mostly gives me solutions that include the renewal of an certificate, something I've already handled using my certificate provider's website.
Contoso is a placeholder name and not a real company.