1. Process
This article details the way to remove certificates using PowerShell.
The Cmdlet used to delete certificates is Remove-Item
Let’s take for example the following certificate: SCOM-ECO.
To check if the certificate is present in the store of the machine:
Launch the PowerShell Console.
2. PowerShell Script
If (Test-Path 'Cert:\LocalMachine') {
Set-Location Cert:\LocalMachine
}
Else {
Write-Host 'Error - Cert:\LocalMachine path does not exist'
Exit
}
Try {
Get-ChildItem -Recurse | Where-Object {$_.Subject -eq "CN=SCOM-ECO, DC=dom, DC=net"} | Remove-Item
Write-Host "Certificates removed"
}
Catch {
Write-Host "Exception caught in removing certificate"
Exit
}









