To display a progress bar for downloading files, check out Jason Niverβs message:
Download files from the Internet to Power Shell (with progress)
Basically, you can create a function that still uses the functionality of the web client, but includes a way to capture status. You can then display the status for the user using the Write-Progress Power shell.
function DownloadFile($url, $targetFile) { $uri = New-Object "System.Uri" "$url" $request = [System.Net.HttpWebRequest]::Create($uri) $request.set_Timeout(15000)
Then you just call the function:
downloadFile "http://example.com/largefile.zip" "c:\temp\largefile.zip"
In addition, here are some other Write-Progress examples.
Write progress
source share