I'm trying to retrieve the certificate of a bunch of IIS websites and match the thumbprint with a certificate that I have. If the thumbprint is matched, that's perfectly fine. However, if the thumbprint is not matched then I want to add that specific certificate to that website. I know I can verify if the desired certificate exists using:
Get-ChildItem -Path Cert:\LocalMachine\My | Select-Object Thumbprint
And I can get the IIS websites and look at bindings using:
Get-ChildItem -Path IIS:Sites | Select-Object -ExpandProperty Bindings
However, I can't figure out how I can retrieve the certificate thumbprint of these websites. I have the target certificate's thumbprint stored in a variable like so:
$CertThumbprint = "###############################"
If I am going at it the wrong way, please let me know. Thank you.