Note: Beginning in Windows PowerShell 3.0, the Certificate provider enhances its support for managing Secure Socket Layer (SSL) certificates for web hosting by enabling you to use the Remove-Item cmdlet to delete certificates and private keys, and to delete user-created certificate stores in the LocalMachine certificate store location. However, you cannot use this feature to delete certificate store locations, such as CurrentUser or LocalMachine, or certificate stores that Windows creates.
So, here goes:
1) First, locate the certificate thumbprint: double-click on the .CER file, go to the “Details” tab and locate the Thumbprint (looks like: xx 1c 60 xx 8a xx 36 ff 0b xx 15 82 d0 xx ed 51 c8 a7 xx 76)
2) remove all the spaces from the copied thumbprint so it will look like: xx1c60xx8axx36ff0bxx1582d0xxed51c8a7xx76
3) find the certificate in the certificate store using:
Get-ChildItem cert: -Recurse |?{$_.Thumbprint -match “xx1c60xx8axx36ff0bxx1582d0xxed51c8a7xx76”}
you will get a response similar to:
Directory: Microsoft.PowerShell.Security\Certificate::CurrentUser\Root
Thumbprint Subject
———- ——-
xx1c60xx8axx36ff0bxx1582d0xxed51c8a7xx76 CN=rootad.pbnet.local
4) Remove the certificate using:
Get-ChildItem cert: -Recurse |?{$_.Thumbprint -match “xx1c60xx8axx36ff0bxx1582d0xxed51c8a7xx76”} | Remove-Item
