This script should email a user in the event that their X509 Certificate is due to expire in X number of days.
Variables to Configure the SMTP Servername and the ExpireInDays .
Test Variables to test if the Script works and receive a notification on a Test Recipient
Search Active Directory for users who have a certificate and check if the certificate will expire in X days.
Check if user is enabled or not, if not no action needed.
If the date is less than the ExpireInDays variable an email will be sent.
Create log file with "Date,Name,EmailAddress,DaystoExpire,ExpiresOn,Notified"
Email each user. In the body of the message should state First Name of the user how many days a user has until their Certificate expires.
Windows PowerShell Module for Active Directory
Windows Server 2008 R2
Domain and Forest Function level Windows Server 2008 R2