You can utilize a short PowerShell script to get a list of all certificates that expire within a certain number of days. This script can then be executed on a regular basis (usually daily) and trigger an (email) alert if one or more expired certificates are found.
The script is shown below:
where the $MaxDays variable indicates the number of days a certificate has left before it is expired. Output from the script when run through the application scheduler will look similar to this:
powershell.exe -inputformat none -file "%SYSTEMROOT%\SYSTEM32\eventsentry\scripts\expiring_certs.ps1" was run for 3 seconds with the result shown below. Return Code was 0.
NotAfter : 7/26/2017 2:40:53 PM
Subject : CN=TEST02K8R2.test.local
Issuer : CN=TEST02K8R2.test.local
Follow the steps below to configure this in EventSentry:
If you haven't already done so, set the proper PowerShell execution policy on the system where the script will be executed, since running PowerShell scripts is disabled by default. The execution policy needs to be either set to "RemoteSigned" (recommended) or "Unrestricted". To set the execution policy, open an elevated PowerShell command prompt and run:
Set-ExecutionPolicy RemoteSigned