使用 XP 批处理文件将 p12 证书导入到 Certificates (Local Computer) \personal store [英] Using an XP batch file to import a p12 certificate into the Certificates (Local Computer) \personal store

查看:36
本文介绍了使用 XP 批处理文件将 p12 证书导入到 Certificates (Local Computer) \personal store的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Windows XP 批处理文件自动将 .p12 证书导入 MMC证书"管理单元调用的内容证书(本地计算机)\Personal\Certificates

I'm trying to use a windows XP batch file to automate importing .p12 certificates into what the MMC "Certificates" snap-in calls Certificates (Local Computer) \Personal\Certificates

certmgr.msc 可能是用于此目的的正确工具,但我已经尝试过

certmgr.msc might be the right tool for this purpose, but I have tried

a:\certmgr.msc /add /c /s /r localMachine a:\<certname>.p12

importpfx -f a:\certs\<certname>.* -p <cert pw> -t MACHINE -s My

还有一些没有成功.通常情况下,MMC 只是在证书卡入时打开.我没有看到任何证书因此实际移动或导入到任何地方.

And a few others without success. Usually, the MMC just opens with the certificates snap in. I've not seen any certs actually moved or imported anywhere as a result.

我也试过不带环境变量和通配符的证书路径\名称,但我得到的证书可能是也可能不是工作站名称.p12..

I've also tried the cert path\name without the environmental variable and wild card, but the certs I get may or may not simply be the workstation name.p12..

有什么建议吗?

-粘土

推荐答案

以下代码适用于 Windows 8 和 Windows Server 2012 R2.我在批处理文件中使用了以下命令:

The below code worked for me on Windows 8 and Windows Server 2012 R2. I used the below command in my batch file:

certutil -f -sid 22 -p [Password1] -importpfx "My"  "%~dp0\whatever.pfx" NoRoot

-sid WELL_KNOWN_SID_TYPE -- Numeric SID
22 -- "Local System", 23 -- "Network Service", 24 -- "Local Service"

这篇关于使用 XP 批处理文件将 p12 证书导入到 Certificates (Local Computer) \personal store的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆