How can I script Windows LAN proxy settings?

0
1
Asked By MellowCedar42 On

I'm a beginner trying to write a script that configures a manual proxy server with a specific IP address and port in Windows. I'm looking for the proxy settings used by regular LAN/web connections, not necessarily the system-wide WinHTTP proxy. The proxy does not require authentication, and I'd also like to understand whether the script should use PowerShell, registry settings, or netsh.

2 Answers

Answered By QuietMaple19 On

For the regular per-user LAN or web proxy settings, Windows stores the configuration under the user’s Internet Settings registry key: `HKCUSoftwareMicrosoftWindowsCurrentVersionInternet Settings`. The main values are `ProxyEnable` as a DWORD set to `1`, `ProxyServer` as a string such as `192.0.2.10:8080`, and optionally `ProxyOverride` for addresses that should bypass the proxy. You can write these values from PowerShell, for example: `Set-ItemProperty -Path 'HKCU:SoftwareMicrosoftWindowsCurrentVersionInternet Settings' -Name ProxyEnable -Type DWord -Value 1`; `Set-ItemProperty -Path 'HKCU:SoftwareMicrosoftWindowsCurrentVersionInternet Settings' -Name ProxyServer -Value '192.0.2.10:8080'`. Add `` to `ProxyOverride` if local addresses should bypass it. Keep in mind that these are user settings, while WinHTTP is a separate system-level configuration.

CopperHawk53 -

Also, `netsh` itself is still used for WinHTTP proxy commands. The deprecation warning generally applies to older firewall commands such as `netsh firewall`, not the entire netsh utility, so it’s worth checking the documentation for the exact command being used.

Answered By BrightOtter7 On

First, make sure you’re targeting the right Windows proxy configuration. `netsh winhttp set proxy :` changes the WinHTTP proxy, which is mainly used by system services and applications that rely on WinHTTP. It does not necessarily change the proxy shown in the normal Windows LAN settings.

MellowCedar42 -

I’m specifically trying to change the Windows LAN proxy settings. There’s no authentication, and all the traffic I need to proxy uses one specific port. I’m not sure whether the WinHTTP commands affect those settings.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.