Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete certificate from Computer Store

I am having difficulty getting powershell to delete a certificate that was accidentally installed to all our Windows 7 machines to the Computer Store.

As an example I have included a screen shot of where the certificate is installed (this is not the actual certificate). We have a few hundred machines so we would like to do this as automatic as possible.

If someone could provide a way to delete the certificate by Serial Number or Thumbprint that would be great.

enter image description here

like image 825
brink668 Avatar asked May 14 '16 16:05

brink668


People also ask

How do I remove a certificate from the store?

Press Windows Key + R Key together, type certmgr. msc, and hit enter. You will get a new window with the list of Certificates installed on your computer. Locate the certificate you want to delete and then click on the Action button then, click on Delete.

How do you delete a certificate in PowerShell?

To delete the Windows certificate using PowerShell, we can use the Remove-Item command.

How do I remove certificates from a remote computer?

To uninstall a certificate from a remote computer, use the `Session`parameter, which was added in Carbon 2.1. 0. You can create a new session with the `New-PSSession` cmdlet. You can uninstall a certificate using just its thumbprint (this functionality is new in Carbon 2.5.


1 Answers

You can use the Cert:-PSDrive with Get-ChildItem and Remove-Item. Ex:

#Delete by thumbprint Get-ChildItem Cert:\LocalMachine\My\D20159B7772E33A6A33E436C938C6FE764367396 | Remove-Item  #Delete by subject/serialnumber/issuer/whatever Get-ChildItem Cert:\LocalMachine\My | Where-Object { $_.Subject -match 'Frode F' } | Remove-Item 
like image 51
Frode F. Avatar answered Sep 25 '22 06:09

Frode F.