Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save shearichard/e204b094ef89906356b30151c8bfacca to your computer and use it in GitHub Desktop.
Save shearichard/e204b094ef89906356b30151c8bfacca to your computer and use it in GitHub Desktop.
Python used to set the "Use a Proxy Server for your LAN" settings in Windows 10 Internet Options (not yet working due to permissions issues)
########################################################################################################
# Python 3.10.
# The 'SetValueEx' doesn't work due to permissions issues. It appears that the answer to that
# is here https://stackoverflow.com/a/41871758 but I haven't tried it.
#
# I found this https://www.blog.pythonlibrary.org/2010/03/20/pythons-_winreg-editing-the-windows-registry/
# to be useful.
#
########################################################################################################
from winreg import *
key = OpenKey(HKEY_CURRENT_USER, r'SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings')
QueryValueEx(key, "ProxyEnable")
SetValueEx(key, "ProxyEnable", 0, 4, 1)
QueryValueEx(key, "ProxyEnable")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment