0

I'm trying to automate connecting to a proxy I have at home. I do this through a powershell script, like the following:

$reg = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
Set-ItemProperty -Path $reg -Name ProxyServer -Value "socks=localhost:8080"
Set-ItemProperty -Path $reg -Name ProxyEnable -Value 1

However, when I check my ip after executing this script, it has not changed. Yet, if I first go to the Connections settings tab of my chrome/IE Internet Properties (inetcpl.cpl), and click ok and nothing else, the proxy then works as intended and my ip is changed. Is there a way to automate/script this jumpstart?

1 Answers1

0

I'm not proud of this solution but here's a workaround it for Windows 10:

netsh wlan connect name=YOUR SSID
:: EnableProxy
@Echo off
set "Key=HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
Set "Val=ProxyEnable"
Set "Typ=REG_DWORD"
Reg add "%Key%" /v %Val% /t %Typ% /d "0x1" /f
start ms-settings:network-proxy
taskkill /F /IM SystemSettings.exe
exit

Basically, I discovered that the changes are applied when I open my Proxy Settings. So I added 2 new lines of command to open and close it immediately.

Potato
  • 1