powershell - 从命令行将 pfx 文件导入到特定的证书存储中

标签 powershell certificate certutil

使用 CertUtil 将证书从 pfx 文件导入用户的个人存储相对容易:

certutil –f –p [certificate_password] –importpfx C:\[certificate_path_and_name].pfx 

但这最终会出现在当前用户的个人存储中。我在 LocalMachine 上的 TrustedPeople 中需要它。

有什么方法可以从命令行执行此操作,可以通过在 certutil importpfx 上调用不同的参数、使用另一个 certutil 命令或不同的实用程序? Powershell 是另一种可能性,尽管我对此了解不多。

干杯, 马特

最佳答案

在这里为 future 的读者锚定我的发现。

将证书导入到本地计算机上受信任的根证书颁发机构:

CERTUTIL -addstore -enterprise -f -v root "somCertificat.cer"

将 pfx 导入到本地计算机上的 Personal

CERTUTIL -f -p somePassword -importpfx "somePfx.pfx"

将 pfx 导入到本地计算机上的可信人员 - Link导入pfx.exe

importpfx.exe -f "somePfx.pfx" -p "somePassword" -t MACHINE -s "TRUSTEDPEOPLE"

将证书导入到本地计算机上的受信任人员

Certutil -addstore -f "TRUSTEDPEOPLE" "someCertificate.cer"

关于powershell - 从命令行将 pfx 文件导入到特定的证书存储中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5171117/

相关文章:

powershell - Invoke-Command 更改输出编码

powershell - Azure Powershell : Restoring a blob snapshot to a different VM

powershell - 如何编写对象的单个属性的值?

powershell - 使用 PowerShell 将数据正确导入数组

c# - 为什么我在使用 IIS 时获得 Cryptography_CSP_NoPrivateKey 而在使用 VS 开发服务器时却没有?

iPhone分布: No profiles currently match

c - 如何以编程方式在 OpenSSL 中创建自签名证书(即,不使用 'openssl' CLI 命令)?

windows - Microsoft OCSP 检查(OCSP 与轻量级 OCSP)和 "certutil -url"令人困惑的响应

ssl - 如何以编程方式将证书添加到 Firefox 版本 59,在 firefox 文件夹中找不到 cert9.db