This script allows you to turn off (or on) the ‘Automatically Detect Settings’ check box in Internet Explorer.
I have not been able to find a way which guarantees that this will not be checked. You can set a Group Policy into Internet Explorer Preference Mode, but if a user later changes it, then it will not change back. If you Disable Changing IE Proxy Settings, then the Preference Mode Setting seems not to work.
I have set this script to run at logon, as part of our general login script. It only modifies that one setting, no others. It reads the entire of the binary value, modifies the one binary value that needs changing and then writes back the entire value.
Option Explicit On Error Resume Next 'Create a constant for the HKEY_CURRENT_USER object Const HKCU = &H80000001 'Define variables Dim strComputer Dim strRegistryKey Dim objRegistry Dim strRegistryValue DIm binValue strComputer = "." strRegistryKey = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections" strRegistryValue = "DefaultConnectionSettings" 'Connect to the Registry Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv") 'Retrieve the current settings. objRegistry.GetBinaryValue HKCU, strRegistryKey, strRegistryValue, binValue 'Change the 'Automatically detect settings' box to unticked binValue(8) = 05 'binValue(8) = 13 - Enable this line to check the box instead of uncheck 'Save the changes objRegistry.SetBinaryValue HKCU, strRegistryKey, strRegistryValue, binValue
New info 26th February 2015: Possible values for binValue(8)
I have experimented further with this for a new project and have determined that certainly 3 settings are linked together into the same binary value. The three settings that appear to be linked are:
- Automatically Detect Settings – 8
- Use Automatic Configuration Script – 4
- Use a Proxy Server For Your Lan – 2
The values after each item above are their numeric representation. You need to add 1 to the final value though.
For example, to set Auto Detect and Use Proxy Server, set the value in binValue(8) above to 0B, the hex equivalent of 11 (8 + 2 + 1)
Hopefully that explains the values a little better.