user20874355
user20874355

Reputation:

Powershell Downloadstring giving timeout - can I set timeout or use a different method?

I have two urls that trigger a webservice. I need to schedule triggering these as tasks. So this is how I scheduled the first one.

$url="https://dd.com/dd/RunScheduledTask.aspx?Action=executespecificscheduledmacro&Macro=fetch"
(New-Object System.Net.WebClient).DownloadString("$url");

The above works. I tried invoke-webrequest but it doesn't seem to actually trigger the webservce.

I need to trigger a second web service by going to a different url. Using the method above I get

Exception calling "DownloadString" with "1" argument(s): "The operation has timed out"

The second url looks like

https://dd.com/dd/RunScheduledTask.aspx?Action=executespecificscheduledmacro&Macro=import

Is there a way to set the timeout / expose the timeout or another method I can use?

I just need to load the url and it runs a webservice. It doesn't load a page or anything. Obviously wanting to run in background.

Upvotes: 0

Views: 537

Answers (0)

Related Questions