PowerShell: Downloading Files from Internet

PowerShell v3 comes with a hugely useful new cmdlet called Invoke-WebRequest. You can use it to interact with websites which also includes downloading files.

This will download the SysInternals suite of tools to your computer:

$Source = 'http://download.sysinternals.com/files/SysinternalsSuite.zip'
$Destination = "$env:temp\sysinternalssuite.zip"
Invoke-WebRequest -uri $Source -OutFile $Destination
Unblock-File $Destination

Since downloaded files are blocked by Windows, PowerShell v3 comes with yet another new cmdlet: Unblock-File removes the block. Now you’re ready to unzip the file.

If your Internet connection requires proxy settings or authentication, take a look at the parameters supported by Invoke-WebRequest.

One Response to “PowerShell: Downloading Files from Internet”

  1. jordan 7 olympics November 15, 2012 at 10:06 am #

    I loved your article post.Thanks Again. Really Great.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

revia in alcoholism