SSL Cert Expired

Handian Sudianto 5,821 Reputation points
2024-08-13T09:02:13.4+00:00

Hello,

It's possible to detect SSL certificate expired in the next 30days using powershell?

Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
13,726 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Jacen Wang 980 Reputation points Microsoft External Staff
    2024-08-13T10:13:13.8066667+00:00

    Hello,

    You can combine the following commands to query related information:

    Find Server SSL Certificates:

    $getChildItemSplat = @{
        Path = 'cert:\LocalMachine\My', 'cert:\LocalMachine\WebHosting'
        SSLServerAuthentication = $true
    }
    Get-ChildItem @getChildItemSplat
    

    Find expired certificates:

    Get-ChildItem -Path cert:\LocalMachine\WebHosting -ExpiringInDays 30
    

    For more information refer to: about Certificate Provider - PowerShell | Microsoft Learn

    Best regards

    Jacen

    ———————————————————————————————————————

    If the Answer is helpful, please click "Accept Answer" and upvote it.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.