Setting netsh winhttp proxy on windows server 2019

%3CLINGO-SUB%20id%3D%22lingo-sub-2550929%22%20slang%3D%22en-US%22%3ESetting%20netsh%20winhttp%20proxy%20on%20windows%20server%202019%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2550929%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20Team%2C%3C%2FP%3E%3CP%3Elet%20me%20explain%20my%20scenario%20here%2C%3C%2FP%3E%3CP%3EI%20want%20to%20setup%20winhttp%20proxy%20for%20windows%20server%202019%20and%202016%20through%20PowerShell%20and%20use%20the%20same.%3C%2FP%3E%3CP%3Ewhat%20i%20already%20did%20and%20not%20worked%3A%3C%2FP%3E%3CP%3E1.%20i%20simply%20used%20netsh%20winhttp%20set%20proxy%20proxy-server%3D%22value1%22%20bypass-list%3D%22value2%22%3C%2FP%3E%3CP%3Eit%20sets%20the%20proxy%20for%20winhttp%20but%20when%20the%20next%20command%20of%20invoke-webrequest%20comes%2C%20it%20uses%20internet%20explorer%20proxy%20and%20ignores%20my%20winhttp%20proxy.%3C%2FP%3E%3CP%3E2.%20I%20setup%20the%20registry%20keys%20for%20HKCU%20for%20internet%20explorer%20and%20then%20try%20to%20acquire%20it%20from%20IE%3A%3C%2FP%3E%3CP%3EREG%20add%20'HKCU%5CSoftware%5CMicrosoft%5CWindows%5CCurrentVersion%5CInternet%20Settings'%20%2Fv%20ProxyEnable%20%2Ft%20REG_DWORD%20%2Fd%201%20%2Ff%3C%2FP%3E%3CP%3EREG%20add%20'HKCU%5CSoftware%5CMicrosoft%5CWindows%5CCurrentVersion%5CInternet%20Settings'%20%2Fv%20ProxyServer%20%2Ft%20REG_SZ%20%2Fd%20%22value1%22%20%2Ff%3C%2FP%3E%3CP%3EREG%20add%20'HKCU%5CSoftware%5CMicrosoft%5CWindows%5CCurrentVersion%5CInternet%20Settings'%20%2Fv%20ProxyOverride%20%2Ft%20REG_SZ%20%2Fd%20%22value2%22%20%2Ff%3C%2FP%3E%3CP%3Enetsh%20winhttp%20import%20proxy%20source%20%3Die%3C%2FP%3E%3CP%3Ethe%20above%20commands%20picking%20up%20the%20registry%20values%20corectly%20but%20internet%20explorer%20is%20not%20acquiring%20them%20and%20netsh%20winhttp%20import%20proxy%20source%20%3Die%20%2C%20still%20results%20in%20direct%20access%20connection.%20i%20have%20tried%20putting%20start%20iexplore%2FTaskkill%20%2FF%20%2FIM%20iexplore.exe%20after%20setting%20the%20values%20in%20registry%20but%20still%20it%20does%20not%20work%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20even%20tried%20with%20all%20registry%20settings%3C%2FP%3E%3CP%3EREG%20add%20'HKLM%5CSOFTWARE%5CPolicies%5CMicrosoft%5CWindows%5CCurrentVersion%5CInternet%20Settings'%20%2Fv%20ProxyEnable%20%2Ft%20REG_DWORD%20%2Fd%200%20%2Ff%3C%2FP%3E%3CP%3EREG%20add%20'HKCU%5CSoftware%5CMicrosoft%5CWindows%5CCurrentVersion%5CInternet%20Settings'%20%2Fv%20ProxyEnable%20%2Ft%20REG_DWORD%20%2Fd%201%20%2Ff%3C%2FP%3E%3CP%3EREG%20add%20'HKCU%5CSoftware%5CMicrosoft%5CWindows%5CCurrentVersion%5CInternet%20Settings'%20%2Fv%20ProxyServer%20%2Ft%20REG_SZ%20%2Fd%20%22value1%22%2Ff%3C%2FP%3E%3CP%3EREG%20add%20'HKCU%5CSoftware%5CMicrosoft%5CWindows%5CCurrentVersion%5CInternet%20Settings'%20%2Fv%20ProxyOverride%20%2Ft%20REG_SZ%20%2Fd%20%22value2%22%20%2Ff%3C%2FP%3E%3CP%3EREG%20add%20'HKLM%5CSoftware%5CMicrosoft%5CWindows%5CCurrentVersion%5CInternet%20Settings'%20%2Fv%20ProxyEnable%20%2Ft%20REG_DWORD%20%2Fd%201%20%2Ff%3C%2FP%3E%3CP%3EREG%20add%20'HKLM%5CSoftware%5CMicrosoft%5CWindows%5CCurrentVersion%5CInternet%20Settings'%20%2Fv%20ProxyServer%20%2Ft%20REG_SZ%20%2Fd%20%22value1%22%20%2Ff%3C%2FP%3E%3CP%3EREG%20add%20'HKLM%5CSoftware%5CMicrosoft%5CWindows%5CCurrentVersion%5CInternet%20Settings'%20%2Fv%20ProxyOverride%20%2Ft%20REG_SZ%20%2Fd%20%22value2%22%2Ff%3C%2FP%3E%3CP%3Eany%20suggestion%20on%20this%3F%3F%20how%20i%20can%20set%20the%20winhttp%20proxy%20correctly%20and%20use%20my%20next%20command%20to%20use%20that%20only%20for%20future%20connection.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2550929%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EWindows%20Server%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
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
www.000webhost.com