Skip to content

Instantly share code, notes, and snippets.

@mawiseman
Last active March 23, 2023 22:57
Show Gist options
  • Save mawiseman/f6db3c629b67bd4475bf406bc5145d81 to your computer and use it in GitHub Desktop.
Save mawiseman/f6db3c629b67bd4475bf406bc5145d81 to your computer and use it in GitHub Desktop.
Import-Module WebAdministration
$results = Get-ChildItem "IIS:\SslBindings\" | ForEach-Object {
$store = $_.Store
$thumbprint = $_.Thumbprint
$cert = Get-ChildItem -Path Cert:\LocalMachine\$store | Where-Object { $_.Thumbprint -eq $thumbprint }
[PSCustomObject]@{
Host = $_.Host;
Subject = $cert.Subject;
NotAfter = $cert.NotAfter;
Thumbprint = $cert.Thumbprint
}
}
# Write to console
$results | Format-Table -AutoSize
# Save to file
$results | Export-Csv -Path "c:\temp\iis-bindings.csv" -NoTypeInformation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment