![](/img/trans.png)
[英]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.