通过 PowerShell 检查 Windows 证书过期日期的方法有哪些?
若要从指定存储中获取特定 Windows 证书的过期日期,我们首先需要该证书的完整路径和指纹。如果您不知道指纹,则可以使用友好名称。
使用指纹,
Get-ChildItem Cert:\LocalMachine\root\0563B8630D62D75 | fl *
运行上述命令后,它将获取指纹为 0563B8630D62D75 的证书的所有详细信息。

您可以在此处看到列出了两个字段,NotAfter 和 NotBefore,它们分别显示了逾期日期和开始日期。若要过滤它们,
示例
Get-ChildItem Cert:\LocalMachine\root\0563B8630D62D75 | Select FriendlyName, NotAfter,NotBefore
输出
FriendlyName NotAfter NotBefore ------------ -------- --------- DigiCert 11/9/2031 4:00:00 PM 11/9/2006 4:00:00 PM
使用 FriendlyName 属性,
Get-ChildItem Cert:\LocalMachine\root\ | where{$_.FriendlyName -eq “DigiCert”} | Select FriendlyName, NotAfter,NotBefore若要从远程计算机获取详细信息,请使用 Invoke-Command。
Invoke-Command -ComputerName Test1PC, Test2PC -ScriptBlock {
Get-ChildItem Cert:\LocalMachine\root\ | where{$_.FriendlyName -eq “DigiCert”} | Select FriendlyName, NotAfter,NotBefore
}
广告
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP