How to retrieve certificate thumbprint using PowerShell?

PowerShellMicrosoft TechnologiesSoftware & Coding

A certificate thumbprint is a hash or signature of the thumbprint and it plays a crucial role in the security aspect. To get the certificate thumbprint using PowerShell is very much easy.

We just need to retrieve the path where certificates reside and the default property that is shown on the console will include the certificate thumbprint.

For example, we are going to retrieve the certificate from the personal store.


Get-ChildItem Cert:\LocalMachine\My\


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

Thumbprint                                Subject
----------                                -------
BE5968599974DB77236784FE0B412053646EA3DC  CN=LABMACHINE2K16
B447A2B656A51029078545DC8ABAE9B9A10E8EA6  CN=LABMACHINE2K16
8B42286E6EB01FBA180D5EF9579DDA5376DCD571  CN=testdomain.local
5554087B849282B74FD0FDEDD9CBACD35FD46550  CN=WMSvc-SHA2-LABMACHINE2K16
43E6035D120EBE9ECE8100E8F38B85A9F1C1140F  CN=mysite.local

The above certificates are available in the personal store and you can see the thumbprint details as well.

To get the particular certificate details, you need to filter it out with the certificate unique property like the subject name or friendly name and then you need to select the thumbprint property.


$cert = Get-ChildItem Cert:\LocalMachine\My `
   | where{$_.Subject -eq "CN=mysite.local"}


PS C:\> $cert.Thumbprint
Updated on 18-Mar-2021 07:39:17