public void CleanupCertsOfIssuerDistinguishedName() { DoInLocalMachineCertStores(certStore => { var certs = certStore.Certificates.Find(X509FindType.FindByIssuerDistinguishedName, IssuerDistinguishedName, false); //remove all endpoints from all found certs thumbprints foreach (X509Certificate2 cert in certs) { var CertificateStore = new CertificateStoreUtil(); CertificateStore.RemoveCert(cert.Thumbprint); } //remove all certs certStore.RemoveRange(certs); }); }