Networking / RFC Checking HTTPS Certificate Expiration with PowerShell: Using .NET SslStream Directly
Establish a TLS connection from PowerShell using TcpClient and SslStream, and read-only check the Subject, NotAfter, and remaining days of the presented certificate.