Created
August 18, 2022 21:29
-
-
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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######################################################################################################## | |
# 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