Quantcast
Channel: Active questions tagged powershell-3.0 - Stack Overflow
Viewing all articles
Browse latest Browse all 123

Powershell Net.HttpWebRequest returns "Getresponse with 0 arguments"

$
0
0

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 all articles
Browse latest Browse all 123

Trending Articles



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