我正在写一个导出脚本。但是,由于无法通过包括证书路径中的证书来导出我的证书,所以我被塞住了。
$ChainCertName = "fooCert" # name of the certificate to export
$ChainIssuerName = "BarCert" # certificate issuer
# search for a certificate which contains the requested name and provided by the requested issuer
$ChainCertListToExport = Get-ChildItem -Path cert:\CurrentUser\CA | ?{$_.Subject -Like "*CN=*$ChainCertName*" -and $_.Issuer -Like "CN=$ChainIssuerName*"}
foreach($ChainCertToExport in $ChainCertListToExport | Sort-Object Subject){
# export P7B certificate
$ChainCertDestPath = Join-Path -Path $ExportDirectory -ChildPath "Chain_certificate.p7b"
Export-Certificate -Cert $ChainCertToExport -FilePath $ChainCertDestPath -Type p7b
}我看到可以用函数Export-PfxCertificate找到一些解决方案,但我还没有找到p7b的任何解决方案。
如果有人有这个问题,你能告诉我你的解决方案吗?
发布于 2021-08-25 00:38:51
如果您只需要以.p7b格式导出证书,请使用以下命令:
Get-ChildItem -Path Cert:\CurrentUser\CA | Export-Certificate -FilePath c:\certs\CA.p7b -Type P7B更多细节可以在链接上找到。
https://stackoverflow.com/questions/64391559
复制相似问题