Skip to content

Searching and Installing CertificatesΒΆ

Get all installed certsΒΆ

PowerShell
Get-ChildItem Cert:\ -Recurse

Find cert by thumbprintΒΆ

PowerShell
dir Cert:\CurrentUser\My | Where-Object { $_.Thumbprint -in "THUMBPRINT1", "THUMBPRINT1" }

Tip

Text Only
Different locations:
* CurrentUser
* LocalMachine

Different folders:
* My
* addressbook
* TrustedPeople
* Local NonRemovable Certificates
* REQUEST
* AuthRoot

So sometime it's better to look for all cert to find if there is any as search will look for particular location

Search by Friendly NameΒΆ

PowerShell
dir cert: -Recurse | Where-Object { $_.FriendlyName -like "*Microsoft*" }

Search by Thumbprint anywhereΒΆ

PowerShell
dir cert: -Recurse | Where-Object { $_.Thumbprint -like "*THUMBPRINT*" }

Search By NotAfter (expiry date)ΒΆ

This will list any certificates that isn't valid after the 31 Dec 2020

PowerShell
dir cert: -Recurse | Where-Object { $_.NotAfter -lt (Get-Date 2018-12-31) }

This will list any certificates that will expire the upcomming year, from now and one year ahead

PowerShell
dir cert: -Recurse | Where-Object { $_.NotAfter -gt (Get-Date) -and $_.NotAfter -lt (Get-Date).AddYears(1) }

Uninstall cert by thumbprintΒΆ

PowerShell
Get-ChildItem Cert:\CurrentUser\My\THUMBPRINT | Remove-Item

Uninstall by subject/serial number/issuer/whateverΒΆ

PowerShell
Get-ChildItem Cert:\LocalMachine\My |
Where-Object { $_.Subject -match 'foo' } |
Remove-Item

Install cert as pfxΒΆ

Make sure to select system if for services Make sure to select system if for services Choose cert to install Choose option to export