Recently I needed to disable proxy settings on windows machines in a network. I was trying to remove an old proxy based web content filter (eeewww). I know it is only a few clicks but I am all about not using the sneaker net if i can avoid it. Plus it is always nice to have geek bragging rights.
So what we are trying to accomplish is create a script that will remove the check boxes from the LAN settings boxes as shown in these pictures.
First lets do this using PowerShell as that is the weapon of choice for most IT guys these days. copy and paste the following text into a text editor and save it with a .PS1 extension and you are ready to execute the power shell script.
Set-ItemProperty -Path “Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings” ProxyEnable -value 0
$key = ‘HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections’
$data = (Get-ItemProperty -Path $key -Name DefaultConnectionSettings).DefaultConnectionSettings
$data[8] = 1
Set-ItemProperty -Path $key -Name DefaultConnectionSettings -Value $data
$key = ‘HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections’
$data = (Get-ItemProperty -Path $key -Name SavedLegacySettings).SavedLegacySettings
$data[8] = 1
Set-ItemProperty -Path $key -Name SavedLegacySettings -Value $data
I am also kinda old school and like VB scripting. Why use b script you may ask. Well any user can run this script as themselves and it will bypass security settings on the windows PC and make the changes no matter their permissions on the machine. copy and past the following text to a text editor and save it as a .vbs file and you are ready to deploy.
Set WSHShell = CreateObject(“Wscript.Shell”)
On Error Resume Next
WSHShell.RegDelete “HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections\DefaultConnectionSettings”
WSHShell.RegDelete “HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections\SavedLegacySettings”
WSHShell.RegDelete “HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable”
WSHShell.RegWrite “HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections\DefaultConnectionSettings”,&H46,”REG_BINARY”
WSHShell.RegWrite “HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections\SavedLegacySettings”,&H46,”REG_BINARY”
WSHShell.RegWrite “HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable”, 0, “REG_DWORD”
Set WSHShell = Nothing
these scripts have been tested in windows xp, 2003, vista, 7, 8, 8.1, 2008, and 2012. they work on all versions.
these scripts can now be deployed by manually clicking them or adding them to your logon script routines. either way you do not have to run around with your hair on fire!