Import-Module BitsTransfer Start-BitsTransfer -Source "http://example.com/file.zip" -Destination "C:\temp\file.zip" Use code with caution. Copied to clipboard 3. BITSAdmin (Legacy Command Line)
A major hurdle with PowerShell 2.0 is security protocols. By default, PowerShell 2.0 uses SSL 3.0 or TLS 1.0. Modern websites reject these outdated protocols and require TLS 1.2 or TLS 1.3.
This is the most reliable way to download a file in PowerShell 2.0. It uses the System.Net.WebClient class to handle the transfer. powershell
$credentials = New-Object System.Net.NetworkCredential($username, $password) $webRequest = [System.Net.HttpWebRequest]::Create($url) $webRequest.Credentials = $credentials powershell 2.0 download file
Warning: Start-BitsTransfer is a separate module and is not guaranteed to be present on every bare-bones PowerShell 2.0 installation. Comparison: PowerShell 2.0 vs. Modern PowerShell PowerShell 2.0 Method PowerShell 3.0+ Method None (Must use .NET) Invoke-WebRequest / Start-BitsTransfer Syntax Complexity High (.NET Object Creation) Low (Simple parameters) Default TLS Protocol TLS 1.0 (Fails on modern HTTPS) TLS 1.2+ (Automatic handshake) In-Memory Execution $wc.DownloadString() Invoke-RestMethod / iex(iwr ...) Best Practice Summary Script
In some cases, Start-BitsTransfer may successfully connect to HTTPS servers where System.Net.WebClient fails, because BITS uses different underlying networking components.
# 4. Register the Event Handler for Completion # This block runs when the download finishes Register-ObjectEvent -InputObject $webClient -EventName DownloadFileCompleted -SourceIdentifier WebClient.DownloadFileCompleted -Action Write-Host "Download Complete!" -ForegroundColor Green # Unregister events to clean up Unregister-Event -SourceIdentifier WebClient.DownloadProgressChanged Unregister-Event -SourceIdentifier WebClient.DownloadFileCompleted By default, PowerShell 2
# Force the session to use TLS 1.2 (3072 represents TLS 1.2) [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 $url = "https://secure-site.com" $output = "C:\Tools\tool.exe" $webClient = New-Object System.Net.WebClient $webClient.DownloadFile($url, $output) Use code with caution. 3. Dealing with Authentication and Proxies
It is included by default in Windows 7 and Windows Server 2008 R2 .
Ensure your environment allows scripts to run by checking Get-ExecutionPolicy and adjusting it if necessary (e.g., Set-ExecutionPolicy RemoteSigned ). It uses the System
To use the credentials of the currently logged-in Windows user (for NTLM or Kerberos authentication), set the UseDefaultCredentials property:
Get-BitsTransfer
For PowerShell 2.0, the most straightforward and reliable way to download a file is by using the System.Net.WebClient .NET class. This method works for HTTP, HTTPS, and FTP protocols.