#Powershell Oneliner: Delete Personal / Machine Certificates

While searching for a solution to delete a personal machine certificate, I again found Powershell to provide the best solution.

Let´s say you have a machine certificate Issued by CA “testca.domain.bla” and want to delete it. This is solved in a one liner in Powershell Version 3:

 

get-childitem -path cert:\localmachine\my | where {$_.Issuer -like ‘*testca*’} | remove-item

In Powershell Version 4, you could also use:

Get-ChildItem -Path cert:\LocalMachine\my -DnsName *domain* | Remove-Item

to remove all Certificates with the dnsname *domain* in the name.

The parameter “DnsName” was introduced with Powershell Version 4.

Instead of the path cert:\LocalMachine you could use cert:\CurrentUser for the User certificates.

Once again PowerShell ISE will help you find your way by autosensing even the certificate paths!

Really easy!

 

more at TechNet

Leave a Reply

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

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s