exit 1

finally if ($stream) $stream.Close() if ($fileStream) $fileStream.Close() $client.Dispose()

# The actual download $webClient.DownloadFile($Url, $OutputPath)

function Download-FileWithProgress param($url, $outputPath) $client = New-Object System.Net.WebClient $stream = $null $fileStream = $null