Setting netsh winhttp proxy on windows server 2019

Occasional Visitor

Hello Team,

let me explain my scenario here,

I want to setup winhttp proxy for windows server 2019 and 2016 through PowerShell and use the same.

what i already did and not worked:

1. i simply used netsh winhttp set proxy proxy-server="value1" bypass-list="value2"

it sets the proxy for winhttp but when the next command of invoke-webrequest comes, it uses internet explorer proxy and ignores my winhttp proxy.

2. I setup the registry keys for HKCU for internet explorer and then try to acquire it from IE:

REG add 'HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings' /v ProxyEnable /t REG_DWORD /d 1 /f

REG add 'HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings' /v ProxyServer /t REG_SZ /d "value1" /f

REG add 'HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings' /v ProxyOverride /t REG_SZ /d "value2" /f

netsh winhttp import proxy source =ie

the above commands picking up the registry values corectly but internet explorer is not acquiring them and netsh winhttp import proxy source =ie , still results in direct access connection. i have tried putting start iexplore/Taskkill /F /IM iexplore.exe after setting the values in registry but still it does not work

 

I have even tried with all registry settings

REG add 'HKLM\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings' /v ProxyEnable /t REG_DWORD /d 0 /f

REG add 'HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings' /v ProxyEnable /t REG_DWORD /d 1 /f

REG add 'HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings' /v ProxyServer /t REG_SZ /d "value1"/f

REG add 'HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings' /v ProxyOverride /t REG_SZ /d "value2" /f

REG add 'HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings' /v ProxyEnable /t REG_DWORD /d 1 /f

REG add 'HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings' /v ProxyServer /t REG_SZ /d "value1" /f

REG add 'HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings' /v ProxyOverride /t REG_SZ /d "value2"/f

any suggestion on this?? how i can set the winhttp proxy correctly and use my next command to use that only for future connection.

0 Replies