Finding Expired Certificates

by Mar 25, 2014

PowerShell grants access to your certificate stores by using the cert: drive.

You can use this drive to find certificates based on given criteria. This would list all certificates that have a date in NotAfter that is before today (indicating expired certificates):

$today = Get-Date

Get-ChildItem -Path cert:\ -Recurse | 
  Where-Object { $_.NotAfter -ne $null  } |
  Where-Object { $_.NotAfter -lt $today } |
  Select-Object -Property FriendlyName, NotAfter, PSParentPath, Thumbprint |

Twitter This Tip! ReTweet this Tip!