Get Certification Expiration with PowerShell

In this article I’ll explain how to check for expired certificates. The PowerShell script below opens the certificate store through the PS-drive Cert:\ and lists all certificates that are expire soon. Change the threshold (days) to any value you want.

To check multiple computers or servers just add the Invoke-Command:

A other easy way is to check the current date and gather all certificates and then filter only the objects which are certificates and the NotAfter attribute is older then current date:

To export it to a CSV file just add:

I really like to hear what you have to say about this article:

  • Was this article helpful for you or do you have any questions?
  • Do you have additions, suggestions or any other ideas?
  • Just let me know by leaving a comment below.

Thank you for spending some time at my site and in my blog. I hope you come to visit again soon 😉

 

About Lex van der Horst 201 Articles
Techwire

Be the first to comment

Leave a Reply