Search code examples
windowssecuritycertificate

Is there a command line utility to extract the certificate thumbprint?


I have created a machine certificate. It appears in the Certificates (Local Computer)\Personal\Certificates certificate repository folder. Now I wish to extract its thumbprint using a command line utility.

Unfortunately, the closest thing that I could find is in this article.

I need to be able to perform this procedure on any Windows OS starting with XP.

Thanks.


Solution

  • Old, but maybe this will help someone. Put the following in a powershell script(.ps1) and run it. It will print the thumb to the screen. watch the word wrap in my paste.

    $computerName = $Env:Computername
    $domainName = $Env:UserDnsDomain
    write-host "CN=$computername.$domainname"
    $getThumb = Get-ChildItem -path cert:\LocalMachine\My | where { $_.Subject -match "CN\=$Computername\.$DomainName" }
    $getThumb.thumbprint