According to TechNet, when the
TimeoutSec parameter of
Invoke-WebRequest is ommitted or specified as 0, the timeout is indefinite. There appears to be a bug that causes this value to default to 100 seconds, at least in PowerShell 4. I presume this is because the default value of the underlying
System.Net.HttpWebRequest.Timeout property is 100,000 ms.
The workaround is to specify a large value for
Invoke-WebRequest -Uri… -TimeoutSec [int]::MaxValue
That is, assuming that you want the request to return within 68 years.