Uninstall-Certificate

Removes a certificate from a store for the user or machine account.

Syntax

Uninstall-Certificate -Thumbprint <String> -StoreLocation {CurrentUser | LocalMachine} -CustomStoreName <String> [-WhatIf] [-Confirm] [<CommonParameters>]
 Uninstall-Certificate -Thumbprint <String> -StoreLocation {CurrentUser | LocalMachine} -StoreName {AddressBook | AuthRoot | CertificateAuthority | Disallowed | My | Root | TrustedPeople | TrustedPublisher} [-WhatIf] [-Confirm] [<CommonParameters>]
 Uninstall-Certificate -Certificate <X509Certificate2> -StoreLocation {CurrentUser | LocalMachine} -CustomStoreName <String> [-WhatIf] [-Confirm] [<CommonParameters>]
 Uninstall-Certificate -Certificate <X509Certificate2> -StoreLocation {CurrentUser | LocalMachine} -StoreName {AddressBook | AuthRoot | CertificateAuthority | Disallowed | My | Root | TrustedPeople | TrustedPublisher} [-WhatIf] [-Confirm] [<CommonParameters>]

Description

Uses .NET's certificates API to remove a certificate from a given store for the machine or current user. Use the thumbprint or friendly name to identify which certificate to remove. The thumbprint is unique to each certificate. Friendly names are not guaranteed to be unique. The user performing the removal must have permission on the store where the certificate is located.

Parameters

Name Type Description Required? Pipeline Input Default Value
Thumbprint String The thumbprint of the certificate to remove. true false
Certificate X509Certificate2 The certificate to remove true false
StoreLocation StoreLocation The location of the certificate's store. true false
StoreName StoreName The name of the certificate's store. true false
CustomStoreName String The name of the non-standard, custom store where the certificate should be un-installed. true false
WhatIf SwitchParameter false false
Confirm SwitchParameter false false
CommonParameters This cmdlet supports common parameters. For more information type
Get-Help about_CommonParameters.

EXAMPLE 1

Uninstall-Certificate -Thumbprint 570895470234023dsaaefdbcgbefa -StoreLocation CurrentUser -StoreName My

Removes the 570895470234023dsaaefdbcgbefa certificate from the current user's Personal certificate store.

EXAMPLE 2

$cert = Get-Certificate -FriendlyName 'Carbon Testing Certificate' -StoreLocation LocalMachine -StoreName Root

Uninstall-Certificate -Certificate $cert -StoreLocation LocalMachine -StoreName Root

Removes the certificate with friendly name 'Carbon Testing Certificate' from the local machine's Trusted Root Certification Authorities store.

EXAMPLE 3

Uninstall-Certificate -Thumbprint 570895470234023dsaaefdbcgbefa -StoreLocation LocalMachine -StoreName 'SharePoint'

Demonstrates how to uninstall a certificate from a custom, non-standard store.