PowerShell 7.3 - guide with Using Invoke-WebRequest to Download Large Files and Handling Timeout
I'm not sure how to approach I'm migrating some code and This might be a silly question, but I'm experiencing issues when trying to download large files using `Invoke-WebRequest` in PowerShell 7.3. Specifically, when I attempt to download files larger than 100 MB, I often encounter a timeout behavior, which states: ``` Invoke-WebRequest : The operation has timed out ``` I have tried increasing the timeout period by setting the `-TimeoutSec` parameter to values like 300 seconds, but it doesn't seem to have any effect. Hereβs the command I'm using: ```powershell $uri = 'https://example.com/largefile.zip' $outputPath = 'C:\Downloads\largefile.zip' Invoke-WebRequest -Uri $uri -OutFile $outputPath -TimeoutSec 300 ``` Despite the increased timeout, the download still fails. Additionally, I've noticed that if I try to download the same file using a different tool (like `curl`), it works without issues. Could this be related to network settings or the way PowerShell handles large file downloads? I've also checked my internet connection, and it seems stable. Has anyone else faced similar issues with large downloads in PowerShell, and what workarounds or solutions can you suggest? What's the best practice here? Has anyone else encountered this? I'm working with Powershell in a Docker container on Ubuntu 22.04. The project is a application built with Powershell. This is for a REST API running on Ubuntu 20.04. Thanks, I really appreciate it!