DOWNLOAD

INVOKE-WEBREQUEST

This is the most common way to download a file

PS C:\> Invoke-WebRequest -Uri "https://example.com/file.zip" -OutFile "C:\Path\file.zip"

INVOKE-RESTMETHOD

This is used when the response is JSON or API data

PS C:\> Invoke-RestMethod -Uri "https://example.com/data.json" -OutFile "C:\Path\data.json"

BITS

This uses the Background Intelligent Transfer Service (BITS) to transfer files in the background

PS C:\> Start-BitsTransfer -Source "https://example.com/file.zip" -Destination "C:\Path\file.zip"

Last updated