Aug-12-2018, 09:18 PM
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
*LAN Settings - Add Proxy Address
*LAN Settings - Auto Detect Settings Enable/Disable
*Set Static IP Address
*Set IP Auto Obtain
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.
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
1 |
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" ^ / v ProxyEnable / t REG_DWORD / d 0 / f |
1 |
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" / v ProxyServer / t REG_SZ / d 10.xxx .x.x: 80 / f |
1 |
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" ^ / v AutoDetect / t REG_DWORD / d 1 / f |
1 |
netsh int ipv4 set address name = "Local Area Connection" source = static address = 10.xxx .x.x mask = 255.255 . 255.0 gateway = none |
1 2 3 |
netsh interface ipv4 set address name = "Local Area Connection" source = dhcp netsh interface ipv4 set dnsservers name = "Local Area Connection" source = dhcp |