
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Get Certificate's Start and Expiry Date Using PowerShell
To get the certificate's start and expiry date using PowerShell, we first need to retrieve the certificate details using a thumbprint or other properties like friendly name, subject name, etc.
Let say we have a certificate thumbprint details. So we can use the below command to retrieve the certificate's Start and End date along with the days remaining for the certificate expiry.
Example
Get-ChildItem Cert:\LocalMachine\My\43E6035D120EBE9ECE8100E8F38B85A9F1C1140F ` | Select @{N='StartDate';E={$_.NotBefore}}, @{N='EndDate';E={$_.NotAfter}}, @{N='DaysRemaining';E={($_.NotAfter - (Get-Date)).Days}}
Output
StartDate EndDate DaysRemaining --------- ------- ------------- 3/11/2021 1:58:12 AM 6/11/2021 3:08:10 AM 88
Here, NotBefore mentions the start date of the certificate while the NotAfter property mentions the end date of the certificate.
Advertisements