Private/GetBitsTransferSplatBase.ps1

function GetBitsTransferSplatBase {
    [CmdletBinding()]
    param (
        [Parameter(Mandatory, Position = 0)]
        [string]
        $Source
    )

    $transferParams = @{
        "Source" = $Source
        "Priority" = "Foreground"
        "TransferType" = "Download"
    }
    $proxy = GetProxySettingsForUri -Uri $Source

    if (![string]::IsNullOrWhiteSpace($proxy)) {
        $transferParams["ProxyList"] = $proxy
        Write-Verbose "Using proxy $proxy for BITS transfer from $Source."

        # Explicitly provide proxy settings (skip system-wide auto-configuration)
        $transferParams["ProxyUsage"] = "Override"

        if ($null -ne $Script:ProxyCredentials) {
            $transferParams["ProxyCredential"] = $Script:ProxyCredentials
        }
    }

    return $transferParams
}

# Copyright (c) 2023 AJ Tek Corporation. All Rights Reserved.