Link to home
Start Free TrialLog in
Avatar of parcou
parcou

asked on

How to delete a user certicate with a batch file?

OK..I have a situation where over half of the client PC's certificates expired on 2/25/08. So if I open the

1. MMC
2. Add the snap-in for certificates
3. Under the certificates go to the 'Personal' folder

This is where I find the expired certificate. I have an automated file I can run which is a .bat file that will add a new certificate to the PC. This issue there are then two certificates the old 2/25/08 & the new 3/3/09 certificates are both showing. We cannot authenticate specific apps that require a certificate when both are there. If I open the MMC and delete the old certificate, it all works just fine.

Is there a command string or code I can add to a .bat file to delete all user certificates under the 'Personal' folder of the MMC? Even if it is a .vbs that will work and I can call it from the .bat file. This way I can add a new certificate leaving only one.

Help - Thanks in Advance
ASKER CERTIFIED SOLUTION
Avatar of DanRollins
DanRollins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of parcou
parcou

ASKER

I like the last example that has sample files and there is a code for del certificate:

Example C Program: Deleting Certificates from a Certificate Store
  http://msdn2.microsoft.com/en-us/library/aa382045(VS.85).aspx

Since I am not a programmer I am only familiar with basic DOS. With that link above showing the examples, how can I run this from DOS if the code were in a file?
You would use a C++ compiler to create the executable program, then you would need to distribute that program to any machine that needed to use it.  Then your batch file would execute it as a command.