Remove Certificates via PowerShell

Adam Bertram

Adam Bertram

Read more posts by this author.

If you ever need to know how to remove all certificates from with a specific issuer, here’s a great way to do it.

## This can be a remote PC name as well
$pc = '.'
$cert_store = 'My'

$store = New-Object ("\$pcMy"),'LocalMachine' #LocalMachine could also be LocalUser
## Find all certs that have an Issuer of my old CA
$certs = $store.Certificates | ? {$_.Issuer -eq 'CN=HOST.DOMAIN.COM, DC=DOMAIN, DC=EXT'}
## Remove all the certs it finds
$certs | % {$store.Remove($_)}

Subscribe to Adam the Automator

Get the latest posts delivered right to your inbox

Looks like you're offline!