I'd like to get your ideas how would you get the remaining days for a certificate to expire.
I need to "monitor" a specific certificate expiration and I'd like it to notify (email) for 30 days before it expires till it's renewed.
I can look for the cert by running:
$cert = "AAAAAAAEEEEEEEFIIIIIIIIIOOOOOOOOUUUUUUUU"
Get-ChildItem -Path cert: -Recurse | where {$_.Thumbprint -eq $cert}
but how could I get the remaining days if is below 30?
Any comment or help is always appreciated.
Fixitrod gives the right answer. But if somehow you want to know the exactly date that will expire, you can run the following command:
Get-ChildItem -path cert:\LocalMachine\My | Select-Object NotAfter, Subject
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With