I am using the following command in PowerShell which works fine and good:
certreq -accept -machine "c:\my_csr_response.crt"
This command processes a CA response to a SSL CSR.
My question is how do I get the thumbnail of the newly created certificate generated by this command?
Create an X509Certificate2
object from the file and grab the thumbprint from there.
$CertPath = "C:\my_csr_response.crt"
$Cert = [System.Security.Cryptography.X509Certificates.X509Certificate2]::CreateFromCertFile($CertPath)
$Thumbprint = $Cert.GetCertHashString()
Find it in the cert store with:
Get-ChildItem cert:\ -Recurse |Where-Object {$_.Thumbprint -eq $Thumbprint}