powershell - 提交 CSR 并使用 Get-Certificate 获取新证书
问题描述
我正在尝试使用以下方法从证书服务器获取新证书:
$user = "MYDOMAIN\Administrator"
$pw = ConvertTo-SecureString "mypw" -AsPlainText -Force
$credential = New-Object -typename System.Management.Automation.PSCredential -ArgumentList $user,$pw
Get-Certificate -url https://cs.mytest.com/ADPolicyProvider_CEP_UsernamePassword/service.svc/CEP -DnsName $Env:COMPUTERNAME -CertStoreLocation cert:\LocalMachine\My -Template WorkstationTemplate -Verbose -Credential $credential
但是我回来了:
VERBOSE: Performing the operation "Get-Certificate" on target "https://cs.mytest.com/ADPolicyProvider_CEP_UsernamePassword/service.svc/CEP".
Get-Certificate : CertEnroll::CX509CertificateTemplates::get_ItemByName: Cannot find object or property. 0x80092004 (-2146885628 CRYPT_E_NOT_FOUND)
At line:4 char:1
+ Get-Certificate -url https://cs.mytest.com/ADPolicyProvi ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-Certificate], Exception
+ FullyQualifiedErrorId : System.Exception,Microsoft.CertificateServices.Commands.GetCertificateCommand
我在与测试 CS 相同的机器上执行命令,以确保没有网络问题,并且我以域管理员身份登录。证书服务器在 Server 2016 上作为独立 CA 运行。
我错过了什么?它在抱怨哪个对象?
解决方案
推荐阅读
- c++ - 为什么 pow() 函数没有给出正确的结果来打印两个间隔之间的 armstrong 数,但 num*num*num 在 C++ 中给出?
- docker - 无法登录到私有 docker 注册表,它显示来自守护进程的错误响应:502 Bad Gateway
- biztalk - 无法在 BizTalk 逻辑应用适配器中配置
- html - 如何更正 CSS 样式的元素在按钮上不起作用
- python - 有没有办法在 tf.data 管道中使用 tf.keras.model.predict ?
- laravel - 使用 Laravel Validator 进行内联验证
- android - 如何获取当前在 imageview (Kotlin) 中的图像名称?
- ios - ios 的 Codemagic 自动应用签名失败
- python - Numpy:在两个真/假向量之间生成或交集
- r - 在 R 中向传单地图添加交互式时间滑块