0

I have created a batch file (say test.bat). In test.bat I called the tool certmgr.exe to delete the certificate from the certificate store. But when multiple certificate in store with same name, then certmgr.exe, asking the option like which certificate want to delete.

But I want to if the certmgr.exe find the same name certificate in store, then delete all the certificate, no need to ask to user for confirmation. Any idea?

Thanks,

CrazyCoder
  • 772
  • 5
  • 11
  • 31

1 Answers1

0

I see that you already resolved this issue by using certutil.exe, but another solution using certmgr.exe could be achieved by piping 1 to the certmgr command (so it always delete the first certificate with the specified name) and then looping on that command until no other certificates exist with that name.

So something like:
while(certificateExistsWithName(certName)) //this is pseudocode that would need to be implemented echo 1 | certmgr.exe /del /n "certName" /s myStore... etc

ksun
  • 1,369
  • 2
  • 13
  • 21