Download from sourceforge or fosshub (qBittorrent)

After some clarification via DMs, the issue was that while a file was downloading - it was not the actual installer.

This is because sourceforge requires Wget user agent for a ‘direct’ download that also attempts to grab the latest version.

function Get-BitTorrent {
    param (
        [string]$URI = 'https://sourceforge.net/projects/qbittorrent/files/latest/download',
        [string]$Location = "$env:temp\qbittorrent.exe"
    )
    $WebClient = New-Object System.Net.WebClient
    $WebClient.Headers.Add('user-agent','Wget')
    $WebClient.DownloadFile("$uri", "$Location")
}

Defining the user agent in the webclient appears to resolve the issue.

1 Like