27

If I edit Proxy Settings through the Control Panel, the settings are stored in HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable and ...\ProxyServer. These settings are of course not used when running as a service under LOCAL SYSTEM.

So I tried setting ProxyEnable and ProxyServer under HKEY_USERS\S-1-5-18\... (as well as HKEY_USERS\.DEFAULT\... and all the other users on the system), but that does not work.

How do I set the proxy settings for the LOCAL SYSTEM user?

6 Answers 6

25

It is actually the value in Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections\DefaultConnectionSettings that is used.

Since that is not easily modified, you can modify the proxy settings for a user, export the registry key, modify the path in the exported file to HKEY_USERS\S-1-5-18 and reimport it.

3
  • This solved my problem, many thanks! I ended up writing a Java class to manipulate the DefaultConnectionSettings hex string, as I needed to set the proxy programmatically. Nov 29, 2010 at 4:30
  • Can this work if authentication is required? May 7, 2019 at 7:15
  • I had to use another ID than S-1-5-18 and I retrieved it by issuing: wmic useraccount get name,sid|findstr some-user-name.
    – 030
    Oct 6, 2021 at 8:59
12

First, run cmd as administrator to open a command prompt.

Command to copy proxy settings of current user to WinHttp:

netsh winhttp import proxy source =ie

To reset the proxy to default settings:

netsh winhttp reset proxy

To show proxy settings of current user:

netsh winhttp show proxy
2
  • 4
    One liner: netsh winhttp import proxy source =ie
    – Vadzim
    May 22, 2017 at 7:28
  • 3
    this doesn't work running as a SYSTEM it will return none
    – AK_
    Mar 27, 2021 at 21:38
7

Another way, albeit much messier, is to use psexec to open a command prompt running as LOCAL SYSTEM, then from that open iexplore.exe, modify the settings appropriately.

1
  • PsExec.exe -i -s regedit /s "%~dp0Internet Settings.reg"
    – Vadzim
    May 22, 2017 at 7:26
3

The Same thing can be done much easier in this way-

& C:\windows\System32\bitsadmin.exe /Util /SetIEProxy LocalSystem Manual_proxy http://<proxyserver>:<proxy port> "<Any bypasses to be added>"
1

Reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v "ProxyEnable" /t REG_DWORD /d "0" /f

Reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v "ProxyServer" /t REG_SZ /d "http://procycorp.bac:80" /f

2
  • 2
    Does that actually work now? 7 years ago when I last tried this, it just changed the values in the registry, but you had to change Connections\DefaultConnectionSettings to actually get Windows to use the procy server. Oct 31, 2015 at 6:29
  • 1
    This sets the current user (CU in HKCU), so not the local system user. Jan 17, 2019 at 14:45
0

You might want to try using ProxyCFG.EXE, which sets the proxy for any WinHTTP calls.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.