Change Windows System Wide Proxy with Batch Script

Just stumbled upon a useful script that can be executed with batch script on windows to change system wide proxy setting ( IE > Internet Options > Connections > LAN Settings )

This can be useful when u have hundred computer on a domain network ( for example let say we have 300 computers ) and u need to change the proxy setting in no time yeah that would be pain in the ass if u had to manually change them one by one , u can just add it to the default startup script on the AD

To setup , open ur text editor , and here’s to enable the proxy

setlocal
set SUBKEY=Software\Microsoft\Windows\CurrentVersion\Internet Settings
reg add "HKCU\%SUBKEY%" /f /v MigrateProxy /t REG_DWORD /d 0x1
reg add "HKCU\%SUBKEY%" /f /v ProxyEnable /t REG_DWORD /d 0x1
reg add "HKCU\%SUBKEY%" /f /v ProxyServer /t REG_SZ /d "x.x.x.x:p"
reg add "HKCU\%SUBKEY%" /f /v ProxyOverride /t REG_SZ /d "<local>"
endlocal

Remember to replace x.x.x.x:p with the IP address and port of ur desirable proxy server..

And to disable

setlocal
set SUBKEY=Software\Microsoft\Windows\CurrentVersion\Internet Settings
reg delete "HKCU\%SUBKEY%\Connections" /f
reg add    "HKCU\%SUBKEY%" /f /v MigrateProxy /t REG_DWORD /d 0x1
reg add    "HKCU\%SUBKEY%" /f /v ProxyEnable /t REG_DWORD /d 0x0
reg delete "HKCU\%SUBKEY%" /f /v ProxyServer
reg delete "HKCU\%SUBKEY%" /f /v ProxyOverride
endlocal

Then , save the files as .bat

 

Tested on Windows XP & Windows 7 , but this should be work in Vista and later version of Windows too…

 

Oh yeah , previously i also write about changing proxy setting via registry script , but that method requires user intervention to do so unlike this one 😀

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s