diff options
Diffstat (limited to 'coin/provisioning/common/windows/set-proxy.ps1')
-rw-r--r-- | coin/provisioning/common/windows/set-proxy.ps1 | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/coin/provisioning/common/windows/set-proxy.ps1 b/coin/provisioning/common/windows/set-proxy.ps1 index 914769f1..2b985b09 100644 --- a/coin/provisioning/common/windows/set-proxy.ps1 +++ b/coin/provisioning/common/windows/set-proxy.ps1 @@ -36,27 +36,24 @@ $n = $n.Split('=') New-Variable -Name $n[0] -Value $n[1] if (([string]::IsNullOrEmpty($proxy)) -or ($proxy -eq '""')) { - echo "No proxy is defined." -} -else { - echo "Checking proxy @ $proxy" + Write-Host "No proxy is defined." +} else { + Write-Host "Checking proxy @ $proxy" $proxy = $proxy -replace '"', "" $webclient = New-Object System.Net.WebClient $proxy_obj = New-Object System.Net.WebProxy($proxy) $webclient.proxy = $proxy_obj try { $webpage = $webclient.DownloadData("http://proxy.intra.qt.io") - } - catch { + } catch { $ErrorMessage = $_.Exception.Message $FailedItem = $_.Exception.ItemName $iserror = $true } if ($iserror -eq $true) { - echo "Testing download with proxy does not work: $ErrorMessage, $FailedItem. Not setting proxy." - } - else { - echo "Setting proxy to: $proxy" + Write-Host "Testing download with proxy does not work: $ErrorMessage, $FailedItem. Not setting proxy." + } else { + Write-Host "Setting proxy to: $proxy" Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name ProxyServer -Value "$proxy" Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name ProxyEnable -Value 1 Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name ProxyOverride -Value 10.215 |