Quantcast
Viewing latest article 7
Browse Latest Browse All 120

Powershell Net.HttpWebRequest returns "Getresponse with 0 arguments"

I have a small script that retrieves a website's SSL's expiring date.

here's the code:

[Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}$timeoutMilliseconds = 10000$req = $null$req = [Net.HttpWebRequest]::Create("https://google.com")$req.Timeout = $timeoutMilliseconds$req.GetResponse();$expiration = $req.ServicePoint.Certificate.GetExpirationDateString()$expiration

This works exactly twice(!) before throwing a "Getresponse with 0 arguments".If I re-open powershell it'll work again exactly 2 times.I'm unsure what's going on here...


Viewing latest article 7
Browse Latest Browse All 120

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>