Tuesday, July 19, 2011

Certificate Installation

The following command installs a certificate to the specified store on the local machine.  In this case the .cer file and certmgr.exe were in the same folder.

certmgr.exe -add -c certificatefilename.cer -s TrustedPublisher -r localMachine

I tried lots of variations but was unable to get certmgr.exe to delete a certifcate from a store using various parameters after the -del switch

Certutil.exe is a server utility but it does work on clients as well.  Example usage adding and removing certificates from stores is:
Adding:
certutil -addstore Root certificatefilename.cer
or
certutil -addstore TrustedPublisher certificatefilename.cer
Removing - first find the certificate serial number by viewing it withing the certificate management gui. Provide the serial number to the command line
certutil -delstore Root SerialNumber
certutil -delstore TrustedPublisher SerialNumber

Certutil.msc for user certs
certlm.msc for machine certs