Delete client authentication certificate from local machine personal store with a specific template name

Note to self which I hope will help others.

I needed to remove a specific client authentication certificate from the local machine personal store due to some CRL issues on an issued certificate in a PKI ConfigMgr environment.

The following code sorted the problem for me:

Get-ChildItem cert:\LocalMachine\my\ |Where-Object{ ($TmplExt = $_.Extensions |Where-Object { $_.Oid.FriendlyName -match 'Certificate Template' }) -and $TmplExt.format(0) -match 'SPECIFIC_TEMPLATE_NAME' } | Remove-Item

Obviously change the SPECIFIC_TEMPLATE_NAME to your certificates template name.

Hope that helps.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s