Python Forum
Code to change LAN Settings
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Code to change LAN Settings
#1
I need to change LAN settings within IE and LAN adapter settings as part of my script but cannot get it working.
I have a Batch file that currently does this that is called from my Python program but ideally i want everything done within Python.

The functions i require are:

*LAN Settings - Proxy Enable/Disable
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" ^ /v ProxyEnable /t REG_DWORD /d 0 /f
*LAN Settings - Add Proxy Address
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t REG_SZ /d 10.xxx.x.x:80 /f
*LAN Settings - Auto Detect Settings Enable/Disable
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" ^ /v AutoDetect /t REG_DWORD /d 1 /f
*Set Static IP Address
netsh int ipv4 set address name="Local Area Connection" source=static address=10.xxx.x.x mask=255.255.255.0 gateway=none
*Set IP Auto Obtain
netsh interface ipv4 set address name="Local Area Connection" source=dhcp

netsh interface ipv4 set dnsservers name="Local Area Connection" source=dhcp
I have tried using subprocess() with no joy i suspect it could be an issue with UAC elevation ??? in my batch file i have some code that automatically elevates to "Run As Administrator" but i cannot find an example of similar code for python.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Change code from using UDP socket to TCP leemao 0 1,459 Feb-28-2020, 02:29 PM
Last Post: leemao

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020