在 Admin-User 下导入 PFX 有效,但在 Non-Admin-User 下它不会。为什么?

Import PFX under Admin-User works, but under Non-Admin-User it won't. Why?

环境:Windows10 Enterprise 2016 LTSB(版本:1607;内部版本:14393.2879)

每年我们都会用脚本更改证书。 pfx 文件 + pwd 将交付。

用户上下文中的脚本 运行s。

去年 运行 的证书在管理员和非管理员用户下使用提供的密码手动生成。

问题: 新证书只能在管理员用户下自动运行或在非管理员用户下手动运行。但是为什么?

如果我在导入后检查属性,从旧到新的证书选项是相同的。

如何解决问题?

格雷茨

$SecurePassword = ConvertTo-SecureString $PWD -AsPlainText -Force
Get-ChildItem -Path $Path | Import-PfxCertificate -CertStoreLocation Cert:\CurrentUser\My -Password $SecurePassword

错误报告为...

certificate could not be added.

Import-PfxCertificate 语句应该没问题,因为您始终可以将证书导入到您自己的用户存储 (cert:\CurrentUser\My)。我能看到的唯一问题是证书文件(您在 $Path 中的文件)是否位于非管理员无法访问的地方。