Examining Certificate Details

If you’d like to examine and view the details of a certificate file without the need to import it into your certificate store, here is a simple example:

# replace path with actual path to CER file 
$Path = 'C:\Path\To\CertificateFile\test.cer'

Add-Type -AssemblyName System.Security
[Security.Cryptography.X509Certificates.X509Certificate2]$cert = [Security.Cryptography.X509Certificates.X509Certificate2]::CreateFromCertFile($Path)

$cert | Select-Object -Property *

You can now access all details and retrieve thumbprint or check expiration date:

PS C:\> $cert.Thumbprint

PS C:\> $cert.NotAfter

Monday June 12 2017 06:00:00

Twitter This Tip! ReTweet this Tip!