Created
October 25, 2023 13:28
-
-
Save Apoc70/71d94d7d1c8facfb8df5cc1e32a49acd to your computer and use it in GitHub Desktop.
Query the current IIS SSL Bindings and provide the IIS Site and bound certificate as output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Original source: https://techstronghold.com/scripting/@rudolfvesely/powershell-script-to-get-all-iis-bindings-and-ssl-certificates/ | |
# Updated the script for a sorted output on Exchange Servers | |
Import-Module -Name WebAdministration | |
Get-ChildItem -Path IIS:SSLBindings | Sort-Object Port | ForEach-Object -Process ` | |
{ | |
if ($_.Sites) | |
{ | |
$certificate = Get-ChildItem -Path CERT:LocalMachine/My | | |
Where-Object -Property Thumbprint -EQ -Value $_.Thumbprint | |
[PsCustomObject]@{ | |
Sites = $_.Sites.Value | |
CertificateFriendlyName = $certificate.FriendlyName | |
CertificateDnsNameList = $certificate.DnsNameList | |
CertificateNotAfter = $certificate.NotAfter | |
CertificateIssuer = $certificate.Issuer | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment