A high-performance PowerShell cmdlet for downloading files with advanced features including multi-protocol support, parallel downloads, retry logic, throttling, and more.
- Multi-Protocol Support: HTTP, HTTPS, HTTP/3, FTP, and SCP
- HTTP/3 Support: Leverage the latest HTTP protocol for improved performance (requires .NET 6+ and Windows 11/Server 2022+)
- Parallel Downloads: Download multiple files concurrently with configurable concurrency limits
- Automatic Retry: Exponential backoff retry logic for failed downloads
- Bandwidth Throttling: Control download speed to manage network usage
- Resume Capability: Resume interrupted downloads (HTTP/HTTPS only)
- Checksum Validation: Verify file integrity with MD5, SHA1, SHA256, or SHA512
- Progress Tracking: Real-time progress updates with download speed
- Authentication Support: PSCredential support for FTP, SCP, and HTTP Basic Auth
- Custom Headers: Add custom HTTP headers for advanced scenarios
- Pipeline Support: Process URIs from pipeline input
# Import the module for current session
Import-Module "C:\Users\andyb\work\dl-invoke\Invoke-Download.psd1"
# Add to your PowerShell profile for automatic loading
Add-Content $PROFILE "`nImport-Module 'C:\Users\andyb\work\dl-invoke\Invoke-Download.psd1'"# Copy module to user modules directory
$modulePath = "$env:USERPROFILE\Documents\PowerShell\Modules\Invoke-Download"
New-Item -Path $modulePath -ItemType Directory -Force
Copy-Item "C:\Users\andyb\work\dl-invoke\*" -Destination $modulePath -Recurse
# Import the module
Import-Module Invoke-Download# Copy to system modules directory (requires admin)
$modulePath = "$env:ProgramFiles\PowerShell\Modules\Invoke-Download"
New-Item -Path $modulePath -ItemType Directory -Force
Copy-Item "C:\Users\andyb\work\dl-invoke\*" -Destination $modulePath -Recurse- PowerShell 5.1 or higher (PowerShell 7+ recommended for HTTP/3 support)
- Windows 11 or Windows Server 2022+ for HTTP/3 support
- .NET 6 or higher for HTTP/3 support
- Posh-SSH module for SCP support (optional):
Install-Module -Name Posh-SSH
# Download a single file
Invoke-Download -Uri "https://example.com/file.zip" -Destination "C:\Downloads\file.zip"# Limit bandwidth to 1MB/s
Invoke-Download -Uri "https://example.com/largefile.iso" `
-Destination "C:\Downloads\" `
-ThrottleLimit 1MB# Resume a partially downloaded file
Invoke-Download -Uri "https://example.com/largefile.iso" `
-Destination "C:\Downloads\largefile.iso" `
-Resume# Download multiple files concurrently
$urls = @(
"https://example.com/file1.zip",
"https://example.com/file2.zip",
"https://example.com/file3.zip"
)
Invoke-Download -Uri $urls `
-Destination "C:\Downloads\" `
-MaxConcurrent 3 `
-MaxRetries 5# Download from FTP server
$cred = Get-Credential
Invoke-Download -Uri "ftp://ftp.example.com/file.txt" `
-Destination "C:\Downloads\" `
-Credential $cred# Download and verify file integrity
Invoke-Download -Uri "https://example.com/file.zip" `
-Destination "C:\Downloads\file.zip" `
-Checksum "a3f5c2d17b8e4a9c8f1d2e4a6b8c9d0f..." `
-ChecksumAlgorithm SHA256# Use HTTP/3 with authorization header
Invoke-Download -Uri "https://api.example.com/download/file.zip" `
-Destination "C:\Downloads\" `
-UseHttp3 `
-Headers @{
"Authorization" = "Bearer your-token-here"
"X-Custom-Header" = "value"
}# Download via SCP (requires Posh-SSH module)
$cred = Get-Credential
Invoke-Download -Uri "scp://user@server.com/path/to/file.txt" `
-Destination "C:\Downloads\" `
-Credential $cred# Process URLs from pipeline
Get-Content "urls.txt" | Invoke-Download -Destination "C:\Downloads\"
# Or with custom objects
@(
@{Uri="https://example.com/file1.zip"; Name="file1.zip"},
@{Uri="https://example.com/file2.zip"; Name="file2.zip"}
) | ForEach-Object {
Invoke-Download -Uri $_.Uri -Destination "C:\Downloads\$($_.Name)"
}# Full configuration example
Invoke-Download -Uri "https://example.com/file.zip" `
-Destination "C:\Downloads\file.zip" `
-MaxRetries 5 `
-RetryDelay 3 `
-ThrottleLimit 2MB `
-Timeout 600 `
-Resume `
-Checksum "abc123..." `
-ChecksumAlgorithm SHA256 `
-UserAgent "MyApp/1.0" `
-Headers @{"X-API-Key"="secret"} `
-Force `
-Verbose-Uri(Required): URL(s) to download. Supports HTTP, HTTPS, FTP, and SCP protocols-Destination(Required): Output path for downloaded file(s)
-MaxRetries: Maximum retry attempts (default: 3)-RetryDelay: Initial delay between retries in seconds (default: 2)-Resume: Resume partial downloads if supported by server
-ThrottleLimit: Maximum bandwidth in bytes/second (0 = unlimited)-MaxConcurrent: Maximum concurrent downloads for multiple files (default: 4)-Timeout: Timeout in seconds for each attempt (default: 300)
-Checksum: Expected checksum value for validation-ChecksumAlgorithm: Algorithm for checksum (MD5, SHA1, SHA256, SHA512)-Credential: PSCredential for authenticated downloads
-UserAgent: Custom User-Agent string-Headers: Hashtable of custom HTTP headers-UseHttp3: Attempt HTTP/3 protocol (requires .NET 6+ and Windows 11+)
-Force: Overwrite existing files without prompting-Quiet: Suppress progress output
- Enable HTTP/3 for modern servers:
-UseHttp3 - Use parallel downloads for multiple files:
-MaxConcurrent 4 - Adjust buffer sizes by modifying the module (default: 8KB)
- Resume downloads on unstable connections:
-Resume - Throttle bandwidth to prevent network saturation:
-ThrottleLimit 5MB
- Full support for HTTP/1.1, HTTP/2, and HTTP/3
- Resume capability with Range headers
- Custom headers and authentication
- Automatic decompression
- Binary mode transfers
- Authentication support
- Progress tracking
- Requires
Posh-SSHmodule - SSH key and password authentication
- Custom port support
# Verify .NET version (requires 6.0+)
dotnet --version
# Check PowerShell version (requires 7.0+)
$PSVersionTable.PSVersion# Install Posh-SSH module
Install-Module -Name Posh-SSH -Scope CurrentUserEnsure the server supports Range requests. Test with:
(Invoke-WebRequest -Uri "https://example.com/file.zip" -Method Head).Headers.'Accept-Ranges'- Initial release
- Multi-protocol support (HTTP, HTTPS, HTTP/3, FTP, SCP)
- Parallel downloads with concurrency control
- Automatic retry with exponential backoff
- Bandwidth throttling
- Resume capability
- Checksum validation
- Comprehensive progress tracking
Copyright (c) 2025. All rights reserved.
Contributions are welcome! Please submit issues and pull requests on GitHub.
For issues, questions, or feature requests, please open an issue on GitHub.