[英]How to export the Certificate details related to the particular IIS site using Powershell script
[英]Export certificate from IIS using PowerShell
dir cert:\localmachine\my | Where-Object { $_.hasPrivateKey } | Foreach-Object { [system.IO.file]::WriteAllBytes("c:\$($_.Subject).pfx", ($_.Export('PFX', 'secret')) ) }
來源: 使用私鑰導出證書
這會將所有證書導出到C:\\
。
您可以通過運行來檢查您擁有的證書:
dir cert:\localmachine\my
值得注意的是,當我嘗試導出我的根證書時,由於unicode中的外語字符無效,我不得不使用Thumbprint作為文件名而不是Subject。 這有效:
dir cert:\localmachine\root |
Foreach-Object { [system.IO.file]::WriteAllBytes("c:\temp\$($_.Thumbprint).cer", ($_.Export('CERT', 'secret')) ) }
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.