Every example I've found on StackExchange, and other internet forums, etc all tell me how to get the thumbprint from a certificate already installed into a certificate store. Alternatively, the instructions say to install the cert, then get the thumbprint.
However, I really need to get the thumbprint from the pfx file without installing it.
3 Answers
Get an object in Powershell-3.0 and later, which can then be used with Select and other property accessors:
Get-PfxCertificate -FilePath Certificate.pfx Alternatively, one can use openssl from msys or cygwin. However, this is tricky since it's one of those *nix programs that spews all the useful info to stderr, which gets handled badly in powershell.
openssl pkcs12 -info -in Certificate.pfxNote: Both of these methods require the user to input the password. I've yet to find a fully automated way to do this without manually entering the password each time.
1You can use this one . Will do everything with one command in powershell. Just set the path and Password
Get-PfxCertificate -Filepath "PATH OF THE FILE STORED" -Password ($pwd = ConvertTo-SecureString -String "PASSWORD" -Force -AsPlainText) Following on the previous answers to provide a complete and concise answer. This will print the given certificate's thumbprint:
(Get-PfxCertificate <certificate_path>).ThumbprintIt will interactively ask for the password of the certificate. Use @Zehad's method to provide the password non-interactively