Need Help in PS Script for Internal CA certificate expiration alerts RRS feed

  • General discussion

  • Hi Folks,

    I found below script in Microsoft forum, this works fine.

    However i need to modify the below script to alert me only for a Selected Template Certificates Ex: Web server Template certificates only. Also i need get output for Certificate below.

    Effective Date | Expiration Date | Issued Country/Region | Issues Organizational Unit | Issues Common Name | Issued City | Issued State | Issued Email Address | Requester Name

    Kindly help me with above options.

    $threshold = 30   #Number of days to look for expiring certificates 
    $deadline = (Get-Date).AddDays($threshold)   #Set deadline date 
    Dir Cert:\LocalMachine\My | foreach { 
    If ($_.NotAfter -le $deadline) { $_ | Select Issuer, Subject, NotAfter, @{Label="Expires In (Days)";Expression={($_.NotAfter - (Get-Date)).Days}} } 


    Naveen Raj

    • Changed type Bill_Stewart Friday, November 2, 2018 9:58 PM
    • Moved by Bill_Stewart Friday, November 2, 2018 9:58 PM This is not "fix/debug/rewrite this script I found on the Internet" forum
    Tuesday, July 10, 2018 6:27 PM

All replies