In this post, you will learn three different ways to download remote files using the URL in Powershell.
Below are three different ways that you can download a file in PowerShell.
In all of the below methods, $URL is the HTTP or HTTPS URL of the file you want to download and $Path is the local file system path where you want to save the downloaded file.
Example values:
$URL = "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png"
$Path = "d:\images\googlelogo.png"
Download Using Invoke-WebRequest cmdlet
Invoke-WebRequest -URI $URL -OutFile $Path
Download Using Start-BitsTransfer cmdlet
Start-BitsTransfer -Source $URL -Destination $Path
Download Using New-Object cmdlet
(New-Object System.Net.WebClient).DownloadFile ($URL, $Path)