Description

This PowerShell one-liner will enumerate all certificates on the local computer and display them sorted ascending by the number of days until each certificate expires. This can be useful to check if any certificates on a computer are about to expire.

Script

PowerShell
Edit|Remove
get-childitem cert: -recurse | where-object {$_.NotAfter -gt (get-date)} | select Subject,Thumbprint,@{Name="Expires in (Days)";Expression={($_.NotAfter).subtract([DateTime]::Now).days}} | Sort "Expires in (Days)"