Have you ever had an SSL certificate get expired and you didn’t know about it? Perhaps it was the certificate of a web server or an Exchange server. No matter which, it would be nice to be alerted of expiring certificates, right?
This module, LazyExchangeAdmin.ExchangeCertNotify, can be used to get a list of server certificates that will expire in specified exact number of days. Additionally, it can also be used to create an HTML output that can be useful for email reports.
Windows PowerShell 5.1 (sorry, no PowerShell Core)
Download the module here, and then export it to your preferred folder.
How to Use
Get Details of All Certificates
The output below shows the certificates retrieved from two servers namely AU-DC01 and AU-FILE01.
This output supports piping, too. This means you can export the output to CSV like so:
And you should get a CSV file similar to the one below.
Getting Details of Certificates Expiring in a Specific Number of Days
The -ExpiringInDays parameter accepts multiple integer values.
The output below shows that only those certificates that will expire in EXACTLY 6 and 14 days are returned.
This is useful when you want to use it in a script to send you an alert only when the certificates are about to expire in specific days remaining.
Converting the Output as HTML Report
Helper Script for Monitoring by Email
Copy and save this helper script and name it as CertX.ps1.
Do not forget to edit the variables between the ## START EDIT HERE and ## STOP EDIT HERE lines.
The screenshot below shows that helper script in action.
And the report below is what you can expect to be delivered as email.