【发布时间】:2018-01-19 02:03:53
【问题描述】:
我正在尝试在 PowerShell 中使用 New-SelfSignedCertificate 在 Windows 10 上创建证书,但该命令给了我权限错误。我使用的是管理员帐户。
命令:
New-SelfSignedCertificate -Type Custom -Subject "CN=Contoso Software, O=Contoso Corporation, C=US" -KeyUsage DigitalSignature -FriendlyName MyCert -CertStoreLocation "Cert:\LocalMachine\My"
输出:
New-SelfSignedCertificate : CertEnroll::CX509Enrollment::_CreateRequest: Access denied. 0x80090010 (-2146893808 NTE_PERM)
At line:1 char:1
+ New-SelfSignedCertificate -Type Custom -Subject "CN=Contoso Software, ..."
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-SelfSignedCertificate], Exception
+ FullyQualifiedErrorId : System.Exception,Microsoft.CertificateServices.Commands.NewSelfSignedCertificateCommand
【问题讨论】:
-
您能否访问“Cert:\LocalMachine\My”位置,即查看
Get-item "Cert:\LocalMachine\My"的输出 -
看起来像。没有错误,但输出只是
Name: My -
New-SelfSignedCertificate是你自己写的吗? -
@TheIncorrigible1
New-SelfSignedCertificate是一个内置 cmdlet... -
这意味着窗口没有升高。这意味着该窗口没有管理员权限。启动 PowerShell 时,右键单击以管理员身份运行。或者在未升高的窗口中,
Start-Process powershell.exe -Verb Runas
标签: windows powershell certificate