Home » PowerShell » How to Delete Self-Signed Certificate on Windows

How to Delete Self-Signed Certificate on Windows

In Windows OS, certificates are stored in the certificate store. Use the Remove-Item cmdlet to delete the self-signed certificate, it accepts the Cert:\ store path to remove the certificate.

Self-Signed certificates are created for test purposes and stored locally in the Windows operating system certificate store. The Get-ChildItem cmdlet in PowerShell is used to retrieve the certificates from the certificate store.

In this article, we will discuss how to delete the self-signed certificate on Windows operating systems like Windows 10, Windows 7, Windows Server, etc…

PowerShell Remove-Item to Delete Self-Signed Certificate

Use the Get-ChildItem cmdlet in PowerShell to get certificate information.

Get-ChildItem Cert:\LocalMachine\My

In the above PowerShell script, the Get-ChildItem command gets all the certificates stored in My store and displays their information.

The output of the above PowerShell script to list all certificates is:

PS C:\> Get-ChildItem Cert:\LocalMachine\My\


   PSParentPath: Microsoft.PowerShell.Security\Certificate::LocalMachine\My

Thumbprint                                                                                   Subject
----------                                                                                             -------
88BBB210E2F12DAA9D38AF8254E528F1F3886C7A             CN=localhost
CA93F14DAFCE839B32DE2AC558C9F5F881EE8CF4             CN=CORP-EU-102

To delete a certificate on a Windows system using PowerShell, use the Remove-Item cmdlet that takes the certificate thumbprint as input.

Remove-Item Cert:\LocalMachine\My\88BBB210E2F12DAA9D38AF8254E528F1F3886C7A 

In the above PowerShell script, the Remove-Item command takes the certificate location path with its thumbprint. Every certificate has a unique identifier as Thumbprint.

The above PowerShell script deletes the self-signed certificate from the store. It doesn’t return any output on the PowerShell terminal.

PowerShell Delete Self-Signed Certificate
PowerShell Delete Self-Signed Certificate

Conclusion

I hope the above article on how to delete a self-signed certificate on the Windows OS using the PowerShell Remove-Item cmdlet is helpful to you.

You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.

Recommended Article

How to create a self-signed certificate in PowerShell

How to bind a certificate to the IIS site

How to get SSL certificate information