Tag Archives: script

Checking certificates expiration using Powershell

As the usage of signed certificates grows, the need for an automated way to check them grows as well.

Its not nice to discover your vCenter is disconnected from everything just because you forgot to renew its certificate.

Luckily, its quite easy to script it using powershell:

$urls = @(‘https://www.google.com’,’https://www.yahoo.com’,etc…)

foreach ($url in $urls )


$req = [Net.HttpWebRequest]::Create($url)

$req.GetResponse() | out-null

$expiration = $req.ServicePoint.Certificate.GetExpirationDateString()

$url, $expiration


This will print each website with its expiration date, you can also use ports , if the server have more then one certificate installed on it.

Tagged , ,