Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invoke-WebRequest set time out

Tags:

I have a long running web page that I need Powershell to call. I run it on a nightly basis from the task manager, with the following:

powershell -Command "Invoke-WebRequest https://www.example.com/longrunningtask"  

but the powershell timeout occurs before the website responds. Is there any way to set the timeout on Invoke-WebRequest to be longer than the standard 60 seconds?

like image 337
Josh Avatar asked Dec 07 '15 14:12

Josh


1 Answers

There should be an -TimeoutSec parameter you can feed an integer value to when calling the Invoke-WebRequest cmdlet.

Invoke-WebRequest https://www.example.com/longrunningtask -TimeoutSec 60 
like image 194
Jeffrey Eldredge Avatar answered Sep 24 '22 06:09

Jeffrey Eldredge