Board logo

标题: [转载代码] [PowerShell每日技巧]查找过期证书(20140325) [打印本页]

作者: DAIC    时间: 2014-4-3 10:51     标题: [PowerShell每日技巧]查找过期证书(20140325)

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):
  1. $today = Get-Date
  2. Get-ChildItem -Path cert:\ -Recurse |
  3.   Where-Object { $_.NotAfter -ne $null  } |
  4.   Where-Object { $_.NotAfter -lt $today } |
  5.   Select-Object -Property FriendlyName, NotAfter, PSParentPath, Thumbprint |
  6.   Out-GridView
复制代码
http://powershell.com/cs/blogs/tips/archive/2014/03/25/finding-expired-certificates.aspx




欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2