From 42ac9bbe1e6440dd9e84b6fdd28a4f61792a73f3 Mon Sep 17 00:00:00 2001 From: Mikhail Klimenko Date: Wed, 22 Feb 2017 14:51:05 +0300 Subject: [PATCH] Add proxy credential support --- scripts/fetchDependency.ps1 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1 index 6a40c97588..7c5c2a989d 100644 --- a/scripts/fetchDependency.ps1 +++ b/scripts/fetchDependency.ps1 @@ -81,6 +81,14 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) if ($Dependency -ne "git") # git fails with BITS { try { + $WC = New-Object System.Net.WebClient + $ProxyAuth = !$WC.Proxy.IsBypassed($url) + If($ProxyAuth){ + $ProxyCred = Get-Credential -Message "Enter credentials for Proxy Authentication" + $PSDefaultParameterValues.Add("Start-BitsTransfer:ProxyAuthentication","Basic") + $PSDefaultParameterValues.Add("Start-BitsTransfer:ProxyCredential",$ProxyCred) + } + Start-BitsTransfer -Source $url -Destination $downloadPath -ErrorAction Stop } catch [System.Exception] {