Deleting Certificates

by Oct 8, 2012

If you want to permanently delete a digital certificate in your certificate store, here is how. This line lists all your personal certificates:

PS> Get-ChildItem cert:\CurrentUser\My

To get rid of a certificate, use this code (Warning: deleting certificates that are needed can damage your computer, so be careful to select only certificates you really want to delete):

PS> Get-ChildItem cert:\CurrentUser\My | 
Where-Object { $_.Subject -like 'CN=*test*' } |
ForEach-Object {
    $store = Get-Item $_.PSParentPath
    $store.Open('ReadWrite')
    $store.Remove($_)
    $store.Close()
    }

Twitter This Tip! ReTweet this Tip!