Skip to content

Instantly share code, notes, and snippets.

@robertchong
Last active August 26, 2016 12:17
Show Gist options
  • Save robertchong/3c36357dd8366cae60d5 to your computer and use it in GitHub Desktop.
Save robertchong/3c36357dd8366cae60d5 to your computer and use it in GitHub Desktop.
Locate Expired CA Certificates on Your Windows Machine
#
# LocateExpiredCACerts
# Source: http://blogs.technet.com/b/heyscriptingguy/archive/2012/05/17/3386232.aspx
#
$store=new-object System.Security.Cryptography.X509Certificates.X509Store("\\<COMPUTER_NAME>\CA","LocalMachine")
$store.open("ReadOnly")
$store.certificates | % {
If ($_.NotAfter -lt (Get-Date)) {
$_ | Select Issuer, Subject, @{Label="ExpiredOn";Expression={$_.NotAfter}}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment