Welcome to deBUG.to Community where you can ask questions and receive answers from Microsoft MVPs and other experts in our community.
1 like 0 dislike
2.2k views
in PowerShell by 23 24 33
In PowerShell, How can I get Certificate details like expiration and issue date using its friendly name in Windows Server?

1 Answer

2 like 0 dislike
by 151 169 345
selected by
 
Best answer

How to get Certificate Details in Windows Server Using PowerShell?

In Windows PowerShell, you can easily, use the below cmdlet to get the Certificate details using Issuer, Name, or Friendly Name as the following:

Get-ChildItem -Path Cert:\LocalMachine -Recurse | Where-Object {$_.FriendlyName -eq "Certificate Friendly Name"} | Format-List -Property *

Get Certificate Details in Windows Server Using PowerShell Example:

I have a certificate with a friendly name "IIS Express Development Certificate", and to get the certificate details using PowerShell, I have to use the below cmdlet

Get-ChildItem -Path Cert:\LocalMachine -Recurse | Where-Object {$_.FriendlyName -eq "IIS Express Development Certificate"} | Format-List -Property *

Output

PSPath                   : Microsoft.PowerShell.Security\Certificate::LocalMachine\My\F433EEC2D7A9DE52B37E08B908D5BCBE691C9817
PSParentPath             : Microsoft.PowerShell.Security\Certificate::LocalMachine\My
PSChildName              : F433EEC2D7A9DE52B37E08B908D5BCBE691C9817
PSDrive                  : Cert
PSProvider               : Microsoft.PowerShell.Security\Certificate
PSIsContainer            : False
EnhancedKeyUsageList     : {Server Authentication (1.3.6.1.5.5.7.3.1)}
DnsNameList              : {localhost}
SendAsTrustedIssuer      : False
EnrollmentPolicyEndPoint : Microsoft.CertificateServices.Commands.EnrollmentEndPointProperty
EnrollmentServerEndPoint : Microsoft.CertificateServices.Commands.EnrollmentEndPointProperty
PolicyId                 :
Archived                 : False
Extensions               : {System.Security.Cryptography.Oid, System.Security.Cryptography.Oid}
FriendlyName             : IIS Express Development Certificate
IssuerName               : System.Security.Cryptography.X509Certificates.X500DistinguishedName
NotAfter                 : 2/6/2021 3:00:00 AM
NotBefore                : 2/7/2016 7:23:44 AM
HasPrivateKey            : True
PrivateKey               : System.Security.Cryptography.RSACryptoServiceProvider
PublicKey                : System.Security.Cryptography.X509Certificates.PublicKey
RawData                  : {48, 130, 1, 209...}
SerialNumber             : 66FE7064F86AB18C40555097E609E1FC
SubjectName              : System.Security.Cryptography.X509Certificates.X500DistinguishedName
SignatureAlgorithm       : System.Security.Cryptography.Oid
Thumbprint               : F433EEC2D7A9DE52B37E08B908D5BCBE691C9817
Version                  : 3
Handle                   : 663332341520
Issuer                   : CN=localhost
Subject                  : CN=localhost

Get Certificate Details using PowerShell

If you don’t ask, the answer is always NO!
...