Automatically remove certificate from certificate store

Solution 1:

I don't know of a way to automatically remove such certificates, but you can clean them out by going to Control Panel -> Internet Options -> Content tab -> Certificates. Select the ones you want to get rid of, then click Remove.

Otherwise, you will need to write a utility that detects the smart-card insert event, then lists and remembers all certificates, and finally deletes them from the certificate store upon the smart-card removal event.

If you intend to go this way, besides the detailed documentation one can find on the Microsoft website, here are some references that can give you some understanding of the required programming :

How to enumerate all certificates on a smart card (PowerShell, but can be adapted to C/C##)
A Smart Card Framework for .NET
pcsc-sharp library