Using Invoke-webrequest to download a zip file Tagged: WebRequest This topic contains 1 reply, has 1 voice, and was last updated by Greg Martin 1 year, 4 months ago. Viewing 2 posts - 1 through 2 (of 2 total) Author Posts June 2, 2015 at 10:15 am #25888 Greg MartinParticipant I'm looking to download a zip file from a website. I can do that using something like this: invoke-webrequest "$sourceURI" -outfile "$destinationfilename" however, I would like to see the headers. I know I can capture the output in a variable like so: $output = invoke-webrequest "$source$dailyfilename" -outfile "$destination$dailyfilename" But it is always empty when I use outfile. So if I skip the outfile, how do I get the content stream into a file? Thx! June 2, 2015 at 12:03 pm #25890 Greg MartinParticipant Spoke with Jeff Hicks on Twitter (@JeffHicks) and he gave this solution: $output = invoke-webrequest "$sourceURI" -outfile "$destinationfilename" -passthru | select -Expand headers With this $output has the headers for my subsequent use. Author Posts Viewing 2 posts - 1 through 2 (of 2 total) You must be logged in to reply to this topic.