2015-12-21 73 views
0

我希望将安装在我的IIS上的证书列表导出到列表中(清单名称,域名,到期日期等)。如何将IIS证书列表导出到详细列表中?

我希望将其上传到我的日历中,以便我知道何时更新它们。

+0

它不受IIS的控制,但作为计算机帐户的个人证书存储区的一部分。因此,您需要了解一些查询方法,例如PowerShell或WMI。 –

回答

0

我找到了一个powrshell脚本。 我用notepadd ++找到&替换命令来制作一个正确的CSV。

# Get all certs in MY store of Local Machine profile 
$store = New-Object System.Security.Cryptography.X509Certificates.X509Store("My","LocalMachine") 
$store.Open("ReadOnly") 
$store.Certificates | 
% { 
# Get all extensions for one cert 
$cert = $_ 
$cert.Extensions | 
% { 
# Find "Enhanced Key Usage" extension 
$extension = $_ 
If ($extension.Oid.FriendlyName -eq "Enhanced Key Usage") 
{ 
# Get all enhanced key usages for the cert 
$enhancedKeyUsageExtension = [System.Security.Cryptography.X509Certificates.X509EnhancedKeyUsageExtension]$extension 
$enhancedKeyUsageExtension.EnhancedKeyUsages | 
% { 
# Find "Server Authentication" enhanced key usage 
$enhancedKeyUsage = $_ 
If ($enhancedKeyUsage.FriendlyName -eq "Server Authentication") 
{ 
# We found a cert that will get listed in Server Certificates list in IIS Manager. Show its info 
$cert | Select Subject, Issuer, NotBefore, NotAfter, Thumbprint, SerialNumber 
} 
} 
} 
} 
} 
$store.Close() 

您可以从power shell命令行的ps1文件中运行它,并将结果保存到文件中。 这样的事: 。\ getSSL.ps1 | Out-File myfile.txt