Import a bunch of certificates into the correct certificate store using a script

17,573

I use CertMgr.exe and a simple bat file to import certs.

certmgr.exe -add -c ca.cer -s -r localMachine root  >> log.txt
certmgr.exe -add -c test.cer -s -r localMachine root  >> log.txt
certmgr.exe -add -c edu.cer -s -r localMachine root  >> log.txt

Here is a TechNet article which documents what commands/usage you can do with certmgr.exe

Share:
17,573

Related videos on Youtube

ashiso
Author by

ashiso

Updated on September 17, 2022

Comments

  • ashiso
    ashiso over 1 year

    I have a collection of certificates in a p7b file, and I would like to automatically import each certificate into the correct store depending on the certificate template. What is the best way to do this with a script?

    I tried using certutil -addstore root Certificate.p7b, and that will correctly place all of the root CAs into the root store, but it returns an error if it encounters any other type of certificate.

    I'm willing to use batch scripts, vbscript or powershell to accomplish this task. Thanks!

    • John Homer
      John Homer about 12 years
      I'm assuming the GUI is too cumbersome?