commands

^

Remove-DbaComputerCertificate

Author Chrissy LeMaire (@cl), netnerds.net
Availability Windows only

 

Synopsis

Removes a computer certificate - useful for removing easily certs from remote computers

Description

Removes a computer certificate from a local or remote compuer

Syntax

Remove-DbaComputerCertificate
    [[-ComputerName] <DbaInstanceParameter[]>]
    [[-Credential] <PSCredential>]
    [-Thumbprint] <String[]>
    [[-Store] <String>]
    [[-Folder] <String>]
    [-EnableException]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Remove-DbaComputerCertificate -ComputerName Server1 -Thumbprint C2BBE81A94FEE7A26FFF86C2DFDAF6BFD28C6C94

Removes certificate with thumbprint C2BBE81A94FEE7A26FFF86C2DFDAF6BFD28C6C94 in the LocalMachine store on Server1

Example: 2
PS C:\> Get-DbaComputerCertificate | Where-Object Thumbprint -eq E0A071E387396723C45E92D42B2D497C6A182340 | Remove-DbaComputerCertificate

Removes certificate using the pipeline

Example: 3
PS C:\> Remove-DbaComputerCertificate -ComputerName Server1 -Thumbprint C2BBE81A94FEE7A26FFF86C2DFDAF6BFD28C6C94 -Store User -Folder My

Removes certificate with thumbprint C2BBE81A94FEE7A26FFF86C2DFDAF6BFD28C6C94 in the User\My (Personal) store on Server1

Required Parameters

-Thumbprint

The thumbprint of the certificate object

Alias
Required True
Pipeline true (ByPropertyName)
Default Value

Optional Parameters

-ComputerName

The target computer. Defaults to localhost.

Alias
Required False
Pipeline false
Default Value $env:COMPUTERNAME
-Credential

Allows you to login to $ComputerName using alternative credentials

Alias
Required False
Pipeline false
Default Value
-Store

Certificate store - defaults to LocalMachine (otherwise exceptions can be thrown on remote connections)

Alias
Required False
Pipeline false
Default Value LocalMachine
-Folder

Certificate folder

Alias
Required False
Pipeline false
Default Value My
-EnableException

By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message. This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting. Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.

Alias
Required False
Pipeline false
Default Value False
-WhatIf

Shows what would happen if the command were to run. No actions are actually performed.

Alias wi
Required False
Pipeline false
Default Value
-Confirm

Prompts you for confirmation before executing any changing operations within the command.

Alias cf
Required False
Pipeline false
Default Value

 

Want to see the source code for this command? Check out Remove-DbaComputerCertificate on GitHub.
Want to see the Bill Of Health for this command? Check out Remove-DbaComputerCertificate.