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 |
- Out-GridView
复制代码 http://powershell.com/cs/blogs/tips/archive/2014/03/25/finding-expired-certificates.aspx |