2015-12-21 25 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