I've created a script that downloads files from various sources and save these to a local network share for processing
If I run the script directly from powershell it works and reports error if cannot find the file needed
But if I run the powershell script through SQL Server, if the web file is not found it just hangs the job and does not timeout or report back the error 404
using the command
$Response = Invoke-WebRequest -Uri $source -Outfile $destination -Credential $cred
$StatusCode = $Response.StatusCode
I've tried using the -TimeoutSec and -MaximumRetryCount but these don't work either
Any ideas
Thanks