导入证书 - 访问被拒绝(运行 作为管理员)
Importing Certificates - Access denied (while run as administrator)
我正在努力将我从 Cert:\CurrentUser\My
创建的证书自动添加到 Cert:\CurrentUser\TrustedPublisher
,以便我可以使用 AllSigned ExecutionPolicy。当我使用 Import-PfxCertificate
cmdlet 时(显然是在导出之后),我得到 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
关于这一切的奇怪之处在于,我可以进入证书 MMC 并自己导入证书,但是当尝试通过 PowerShell(作为管理员)运行 时,它给了我错误。
我发现我可以将证书导入 LocalMachine,但不能导入 CurrentUser。
Import-PfxCertificate -FilePath 'Path\Cert.pfx' -Password (Get-Credential).Password -CertStoreLocation Cert:\LocalMachine\Root
Import-PfxCertificate -FilePath 'Path\Cert.pfx' -Password (Get-Credential).Password -CertStoreLocation Cert:\LocalMachine\TrustedPublisher
我正在努力将我从 Cert:\CurrentUser\My
创建的证书自动添加到 Cert:\CurrentUser\TrustedPublisher
,以便我可以使用 AllSigned ExecutionPolicy。当我使用 Import-PfxCertificate
cmdlet 时(显然是在导出之后),我得到 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
关于这一切的奇怪之处在于,我可以进入证书 MMC 并自己导入证书,但是当尝试通过 PowerShell(作为管理员)运行 时,它给了我错误。
我发现我可以将证书导入 LocalMachine,但不能导入 CurrentUser。
Import-PfxCertificate -FilePath 'Path\Cert.pfx' -Password (Get-Credential).Password -CertStoreLocation Cert:\LocalMachine\Root
Import-PfxCertificate -FilePath 'Path\Cert.pfx' -Password (Get-Credential).Password -CertStoreLocation Cert:\LocalMachine\TrustedPublisher