powershell - 使用 certreq 从企业 CA 请求证书时如何抑制弹出窗口?
问题描述
我正在尝试从与我们的企业 CA 服务器位于同一域中的计算机请求证书。一切正常,但我离使我的脚本具有零用户交互仅一步之遥。
我基本上修改了以下脚本以不包含任何参数并删除了 SAN 选项:
https://gallery.technet.microsoft.com/scriptcenter/Request-certificates-from-b6a07151
在使用以下命令从 .inf 文件创建新请求后,我得到一个弹出窗口:
Invoke-Expression -Command "certreq -new `"$inf`" `"$req`""
Machine context template conflicts with user context.
当我单击确定时,一切正常。创建了一个新请求,脚本的其余部分工作正常。但是我找不到以编程方式单击“确定”的方法。
certreq 工具确实具有-q
(抑制交互式提示)和-f
(强制/绕过事物),但这些都不起作用。
certreq -new -q $inf $req
或同时使用-q
和-f
导致:
Active Directory Enrollment Policy
{<GUID>}
ldap:
Machine context template conflicts with user context.
Certificate Request Processor: The specified role was not configured for the application 0x8004e00c (-2147164148 CONTEXT_E_ROLENOTFOUND)
我几乎被困在这里。任何帮助,将不胜感激!
解决方案
您的问题的答案应该是更改 Request-Certificate.ps1 中的参数。查看用于生成请求的 inf 文件并检查MachineKeySet参数。默认为 false 并提示:
Machine context template conflicts with user context.
当模板是一种机器时出现。当您将其切换为真正的 ale 使用用户模板时,会出现相反的提示:
User context template conflicts with machine context.
推荐阅读
- c# - 根据较小的比较字符串中的最小 N 个字符确定重复项
- javascript - 如何使用开发人员工具样式编辑器实时编辑动态 javascript 元素的 CSS?
- meshlab - 带有内部顶点/面的凌乱网格
- javascript - 是否可以在我的 Indesign 脚本的 pdf 导出首选项中有 if else 语句
- excel - Excel VBA代码过滤两列并提取数据
- matlab - 在matlab中使用for循环和矩阵乘法实现一个函数
- windows - Docker 上的 Windows 10 网络问题
- postgresql - 防止多对多自引用关系中的循环(Postgres)
- facebook-analytics - Facebook 分析 - 是否已从人口统计部分中删除了“兴趣”?
- java - Android GridLayout 混乱