How to add certificates to the Windows certificate store

Published:

There's a command-line tool called certutil one can use to (among other things) add certificates to the certificate store in windows.

Some examples:

REM Add pfx-file to Personal
certutil -ent -p pfxpassword -importpfx my some.pfx

REM Add pfx-file to Trusted Root Certification Authorities
certutil -ent -p pfxpassword -importpfx root some.pfx

REM Add cer-file to Trusted Root Certification Authorities
certutil -ent -addstore root some.cer