Skip to content

Commit

Permalink
set windows registry values for proxy (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
rosskirkpat authored May 11, 2022
1 parent aa7a4e3 commit 49a941c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,11 @@ csi-proxy:
$newEnv = @()
$PROXY_ENV_INFO = Get-ChildItem env: | Where-Object { $_.Name -Match "^(NO|HTTP|HTTPS)_PROXY" } | ForEach-Object { "$($_.Name)=$($_.Value)" }
if ($PROXY_ENV_INFO) {
netsh winhttp set proxy $env:HTTPS_PROXY
Set-ItemProperty -path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" ProxyEnable -value 1
Set-ItemProperty -path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" ProxyServer -value "https=$env:HTTPS_PROXY;http=$env:HTTP_PROXY"
Set-ItemProperty -path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" ProxyOverride -value $env:NO_PROXY.Replace(',',';')

$newEnv += $PROXY_ENV_INFO
if(Test-Path -Path HKLM:SYSTEM\CurrentControlSet\Services\$serviceName) {
Set-ItemProperty HKLM:SYSTEM\CurrentControlSet\Services\$serviceName -Name Environment -Value $([string]$newEnv)
Expand Down

0 comments on commit 49a941c

Please sign in to comment.