Batch file 批处理脚本和Web证书

Batch file 批处理脚本和Web证书,batch-file,certificate,login-script,Batch File,Certificate,Login Script,我正在尝试通过登录脚本在多台计算机上安装网站的证书。这是可能的还是最好的选择?我最熟悉批处理脚本,如果有人已经有了一个对我来说是最好的选择,否则我可以在登录脚本中调用vbs 我试图调用证书,但有一些选项,我需要它转到Truster Publisher,以便加载activeX控件,而不向用户提示。我过去也遇到过同样的问题。。。您需要浏览以下命令: certutil.exe certutil.exe -store trustedpublisher 此命令允许您通过命令行安装证书 certutil

我正在尝试通过登录脚本在多台计算机上安装网站的证书。这是可能的还是最好的选择?我最熟悉批处理脚本,如果有人已经有了一个对我来说是最好的选择,否则我可以在登录脚本中调用vbs


我试图调用证书,但有一些选项,我需要它转到Truster Publisher,以便加载activeX控件,而不向用户提示。

我过去也遇到过同样的问题。。。您需要浏览以下命令:

certutil.exe
certutil.exe -store trustedpublisher
此命令允许您通过命令行安装证书

certutil.exe -addstore -f "TrustedPublisher" "<Location_of_Certificate>"
这将为您提供所有受信任的发布者的列表。现在在列表中找到你需要的一个。。。您将看到如下内容(我使用Microsoft根权限作为示例):

序列号:xxxx11dxxx8ffexxxxx 发行人:CN=Microsoft根权限,OU=Microsoft Corporation, OU=版权所有(c)1997微软 公司日期:1997年1月10日凌晨2:00公司日期:2002年12月31日凌晨2:00 主题:CN=Microsoft Windows硬件兼容性,OU=Microsoft 公司,OU=Microsoft Windows硬件兼容性中间产品 CA,OU=版权(c)19 97微软公司非根证书 模板:证书哈希(sha1):xx xx 1c xx xx 45 xx xx b3 xx xx 94 xx xx xx 7c 74 07 33 03 1c无密钥提供程序信息无法找到 用于解密的证书和私钥

现在,您的证书颁发者与将列出的证书完全相同,您可以执行检查:

certutil.exe -store trustedpublisher | findstr "Microsoft Root Authority"
现在,这应该会返回一些与您在原始列表中看到的相同的信息。这是我从头到尾处理流程所做的工作(注意,我将证书添加到受信任的发布者和CA):

:importCertRoot
验证>nul
certutil.exe-store trustedpublisher | findstr“Microsoft根权限”
如果“%ERRORLEVEL%”==“0”转到importCertLocal
验证>nul
certutil.exe-addstore-f“TrustedPublisher”“\”
转到importCertLocal
:importCertLocal
验证>nul
certutil.exe-存储CA | findstr“Microsoft根权限”
如果“%ERRORLEVEL%”==“0”转到退出
验证>nul
certutil.exe-addstore-f“CA”“\”
转到下一个
我希望这对你有帮助

:importCertRoot
verify >nul
certutil.exe -store trustedpublisher | findstr "Microsoft Root Authority"  
IF '%ERRORLEVEL%'=='0' goto importCertLocal
verify >nul
certutil.exe -addstore -f "TrustedPublisher" "<Location_of_Certificate>\<CertName.cer>"
goto importCertLocal

:importCertLocal
verify >nul
certutil.exe -store CA | findstr "Microsoft Root Authority"  
IF '%ERRORLEVEL%'=='0' goto exit
verify >nul
certutil.exe -addstore -f "CA" "<Location_of_Certificate>\<CertName.cer>"
goto next