PowerShell Get Certificate Thumbprint with Password PFX File PowerShell Get Certificate Thumbprint with Password PFX File powershell powershell

PowerShell Get Certificate Thumbprint with Password PFX File


According to this SuperUser response, in PS 3.0 there is Get-PfxCertificate command to do that:

 Get-PfxCertificate -FilePath Certificate.pfx 


You can do this

$certificateObject = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2$certificateObject.Import($CertificatePath, $sSecStrPassword, [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::DefaultKeySet)return $certificateObject.Thumbprint

Remember to set this two variable: $CertificatePath and $sSecStrPassword


The PowerShell error message is right. There are no overloads that take two parameters. Based on the parameters you are using I think you want the overload that requires a third parameter - an enum - X509KeyStorageFlags e.g.

$certificateObject.Import($CertificatePath, $sSecStrPassword, [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::DefaultKeySet)