What key in windows registry disables IE connection parameter "Automatically Detect Settings"?
Asked Answered
M

12

23

I'm trying to set all the connection settings in IE.

I've found how to modify most of them, in the path :

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings

But I can't find the parameter that sets or unsets "Automatically Detect Settings".

Any help ?

Monarchy answered 4/11, 2009 at 14:33 Comment(0)
M
46

I found the solution : it's the 9th byte of this key :

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections] "DefaultConnectionSettings"=hex:3c,00,00,00,1f,00,00,00,05,00,00,00,00,00,00, 00,00,00,00,00,00,00,00,00,01,00,00,00,1f,00,00,00,68,74,74,70,3a,2f,2f,31, 34,34,2e,31,33,31,2e,32,32,32,2e,31,36,37,2f,77,70,61,64,2e,64,61,74,90,0e, 1e,66,d3,88,c5,01,01,00,00,00,8d,a8,4e,9e,00,00,00,00,00,00,00,00

It's a bitfield:

  • 0x1: (Always 1)
  • 0x2: Proxy enabled
  • 0x4: "Use automatic configuration script" checked
  • 0x8: "Automatically detect settings" checked

Mask 0x8 to turn it off, i.e., subtract 8 if it's higher than 8.

Thanks to Jamie on google groups.

Update

Based on the VBScript by WhoIsRich combined with details in this answer, here's a PowerShell script to amend these & related settings:

function Set-ProxySettings {
    [CmdletBinding()]
    param ( #could improve with parameter sets 
        [Parameter(Mandatory = $false)]
        [bool]$AutomaticDetect = $true
        ,
        [Parameter(Mandatory = $false)]
        [bool]$UseProxyForLAN = $false
        ,
        [Parameter(Mandatory = $false)]
        [AllowNull()][AllowEmptyString()]
        [string]$ProxyAddress = $null
        ,
        [Parameter(Mandatory = $false)]
        [int]$ProxyPort = 8080 #closest we have to a default port for proxies
        ,
        [AllowNull()][AllowEmptyString()]
        [bool]$UseAutomaticConfigurationScript = $false
    )
    begin {
        [string]$ProxyRegRoot = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings'
        [string]$DefaultConnectionSettingsPath = (Join-Path $ProxyRegRoot 'Connections')
        [byte]$MaskProxyEnabled = 2
        [byte]$MaskUseAutomaticConfigurationScript = 4
        [byte]$MaskAutomaticDetect = 8
        [int]$ProxyConnectionSettingIndex = 8
    }
    process {
    #this setting is affected by multiple options, so fetch once here 
    [byte[]]$DefaultConnectionSettings = Get-ItemProperty -Path $DefaultConnectionSettingsPath -Name 'DefaultConnectionSettings' | Select-Object -ExpandProperty 'DefaultConnectionSettings'

    #region auto detect
    if($AutomaticDetect) { 
        Set-ItemProperty -Path $ProxyRegRoot -Name AutoDetect -Value 1
        $DefaultConnectionSettings[$ProxyConnectionSettingIndex] = $DefaultConnectionSettings[$ProxyConnectionSettingIndex] -bor $MaskAutomaticDetect
    } else {
        Set-ItemProperty -Path $ProxyRegRoot -Name AutoDetect -Value 0
        $DefaultConnectionSettings[$ProxyConnectionSettingIndex] = $DefaultConnectionSettings[$ProxyConnectionSettingIndex] -band (-bnot $MaskAutomaticDetect)
    }
    #endregion

    #region defined proxy
    if($UseProxyForLAN) {
        if(-not ([string]::IsNullOrWhiteSpace($ProxyAddress))) {
            Set-ItemProperty -Path $ProxyRegRoot -Name ProxyServer -Value ("{0}:{1}" -f $ProxyAddress,$ProxyPort)
        }
        Set-ItemProperty -Path $ProxyRegRoot -Name ProxyEnable -Value 1
        $DefaultConnectionSettings[$ProxyConnectionSettingIndex] = $DefaultConnectionSettings[$ProxyConnectionSettingIndex] -bor $MaskProxyEnabled
    } else {
        Set-ItemProperty -Path $ProxyRegRoot -Name ProxyEnable -Value 0        
        $DefaultConnectionSettings[$ProxyConnectionSettingIndex] = $DefaultConnectionSettings[$ProxyConnectionSettingIndex] -band (-bnot $MaskProxyEnabled)
    }
    #endregion

    #region config script
    if($UseAutomaticConfigurationScript){
        $DefaultConnectionSettings[$ProxyConnectionSettingIndex] = $DefaultConnectionSettings[$ProxyConnectionSettingIndex] -bor $MaskUseAutomaticConfigurationScript
    }else{
        $DefaultConnectionSettings[$ProxyConnectionSettingIndex] = $DefaultConnectionSettings[$ProxyConnectionSettingIndex] -band (-bnot $MaskUseAutomaticConfigurationScript) 
    }
    #endregion

    #persist the updates made above
    Set-ItemProperty -Path $DefaultConnectionSettingsPath -Name 'DefaultConnectionSettings' -Value $DefaultConnectionSettings
    }
}
Monarchy answered 4/11, 2009 at 15:5 Comment(5)
That would be ninth byte, not bit.Zygoma
Thanks for the answer and the google group link..So hex values are 01,05,09 & 0dFisch
There's a bug in the config script logic. Regardless of the value of $UseAutomaticConfigurationScript, the script will -bor the mask. I fixed mine by copying the "-band (-bnot..." logic from the other regions.Valuate
@KeithTwombley I have edited the script to reflect.Quarters
A usage example of this fantastic post would be helpful, especially for those seeking to possibly convert to C# .NETFoucquet
S
10

Another way to control this setting is by using an undocumented registry key AutoDetect=0 mentioned on this blog post:

Registry Key : HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\

DWORD AutoDetect = 0 or 1

So the .reg file to turn it off would look like:

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
"AutoDetect"=dword:00000000
Shep answered 9/9, 2014 at 6:20 Comment(2)
Thanks for this. The key is automatically removed by Windows when the setting is applied, but it allows you to configure this setting alone with GPO (rather than overwriting the entire Default Connection block)Hispid
As @Hispid said this registry key will disappear on you but the new value does seem to stick. I've had some weird interactions when the Internet Options menu was open at the same time or VPNs were in the process of (dis)connecting but this should work for all regular use cases and is vastly easier to understand than flipping bits.Harmonium
R
5

For anyone looking to untick the 'Automatically Detect Settings' box without overwriting the other settings contained in the registry entry, you can use vbscript at logon.

On Error Resume Next

Set oReg   = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
sKeyPath   = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections"
sValueName = "DefaultConnectionSettings"

' Get registry value where each byte is a different setting.
oReg.GetBinaryValue &H80000001, sKeyPath, sValueName, bValue

' Check byte to see if detect is currently on.
If (bValue(8) And 8) = 8 Then

  ' Turn off detect and write back settings value.
  bValue(8) = bValue(8) And Not 8
  oReg.SetBinaryValue &H80000001, sKeyPath, sValueName, bValue

End If

Set oReg = Nothing
Rearm answered 15/4, 2014 at 11:26 Comment(6)
to be clear, does this scrip automatically uncheck the setting? and could you tell me what part of the script to change to check it?Joel
Yes it does uncheck the setting. If you want to check it, have IE set with auto detect on, run the script, and re-open IE and you will see it unticked. You can use RegEdit to look at the value changing, just be aware its a bit / binary change, not your easy to read true/false on/off value.Rearm
NB: To toggle back you'd do bValue(8) = bValue(8) Or 8. This is implementing the logic found in @leo's answer: https://mcmap.net/q/556139/-what-key-in-windows-registry-disables-ie-connection-parameter-quot-automatically-detect-settings-quot. The 8 in brackets is the 9th byte in the byte array. The other 8 is the mask for Automatically detect settings.Alver
After trying a million solutions, this one worked fine on Win7 with IE8 and IE11Myriapod
It is not working on Windows 10. Any suggestions? @RearmExtempore
@ManthanShah It does work on W10, including Edge. Make sure the VBS is actually running, maybe add a temporary MsgBox at the end. After it runs, re-opening 'Windows Setting, Proxy' the top toggle should have changed.Rearm
B
2

I'm aware that this question is a bit old, but I consider that my small update could help other programmers.

I didn't want to modify WhoIsRich's answer because it's really great, but I adapted it to fulfill my needs:

  1. If the Automatically Detect Settings is checked then uncheck it.
  2. If the Automatically Detect Settings is unchecked then check it.

    On Error Resume Next
    
    Set oReg   = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
    sKeyPath   = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections"
    sValueName = "DefaultConnectionSettings"
    
    ' Get registry value where each byte is a different setting.
    oReg.GetBinaryValue &H80000001, sKeyPath, sValueName, bValue
    
    ' Check byte to see if detect is currently on.
    If (bValue(8) And 8) = 8 Then
        ' To change the value to Off.
        bValue(8) = bValue(8) And Not 8
    ' Check byte to see if detect is currently off.
    ElseIf (bValue(8) And 8) = 0 Then
        ' To change the value to On.
        bValue(8) = bValue(8) Or 8
    End If
    
    'Write back settings value
    oReg.SetBinaryValue &H80000001, sKeyPath, sValueName, bValue
    
    Set oReg = Nothing
    

Finally, you only need to save it in a .VBS file (VBScript) and run it.

vbscript

Breve answered 1/6, 2017 at 13:8 Comment(1)
It is not working on windows 10. Any suggestions? @federicoExtempore
G
1

If it is simply to disable a group policy that is enforced every 30 minutes you can uncheck the box then change the permissions to Read Only.

Grati answered 3/9, 2012 at 7:19 Comment(0)
I
1

I have used a combined answer and made a powershell script which does the trick for you

$name = $PSScriptRoot + "\" + $MyInvocation.MyCommand.Name

if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$name`"" -Verb RunAs; exit }

$registryPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings"

$Name = "AutoDetect"

$value = "0"

New-ItemProperty -Path $registryPath -Name $name -Value $value ` -PropertyType DWORD -Force | Out-Null

Read-Host -Prompt "press Enter to Continue"

The script will run as admin and the change the value to 0 ( Disable the Auto-Detect ).

Iranian answered 13/11, 2015 at 13:8 Comment(0)
E
0

You can always just export the registry, change the setting, then export the registry again and do a diff.

Earthward answered 4/11, 2009 at 23:53 Comment(2)
Yes indeed. But the best would be to find the actual specifications regarding this key.Monarchy
In general there are no specifications for IE registry keys. Mostly, as in this case, they are internal implementation details you can't rely on to be the same from release to release.Earthward
M
0

I can confirm this works. I exported the reg file after I had made the adjustments and then put it in a logon script like this:

REM ------ IE Auto Detect Settings FIX ------------------
REG IMPORT \\mydomain.local\netlogon\IE-Autofix.reg 2>NUL
Mayan answered 8/10, 2010 at 8:58 Comment(0)
S
0

Resurrecting this.

Here's how you can modify registry item binary values concisely in easy-to-follow powershell. In this example DefaultConnectionSettings is the registry item with a REG_BINARY value that we're trying to modify.

$path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections"
$objName = "DefaultConnectionSettings"
$getObj = Get-ItemProperty -path $path -name $objName
$getObj.DefaultConnectionSettings[8] = 1
$objValue = $getObj.DefaultConnectionSettings
Set-ItemProperty -path $path -name $objName -Value $objValue

When you use Get-ItemProperty for a registry item with a REG_BINARY value, it gives you a number of child objects in a collection.

By referencing the name of the item (in this case we do getObj.DefaultConnectionSettings) as a child object of getObj, we get an array of values, where each binary value (i.e 50,33,01,00,00,00,00,00,04) has its own position in the array.

Because it is an array we can reference, modify, and iterate through it easily, and we can modify a value by doing $getObj.DefaultConnectionSettings[8] = 1 or whatever number you want in place of 8. The 8 refers to the 9th value in the array. In the example of 50,33,01,00,00,00,00,00,04 the 9th position is 04. Remember that, like other things, arrays start counting at 0.

Setting it = 1 will change that 04 value in the binary to 01 while leaving the rest of the values unchanged in the array.

Finally, we set the change in place with Set-ItemProperty -path $path -name $objName -Value $objValue

Hope this helps others.

Subvene answered 15/7, 2021 at 19:40 Comment(0)
I
-1

Indeed, the 9th byte indicates the check state of the button, but the answers above don't take into account the checkbox which enables manual configuration. This check state value is also present in this ninth byte. The real answer should thus be:

Byte value

00001001 = Manual proxy is checked

00000101 = Use automatic configuration script is checked

00000011 = Automatically detect settings is checked

When multiple checkboxes are checked, the value of the 9th byte is the result of the bitwise OR operation on the values for which the checkbox is checked.

Inefficacious answered 8/9, 2011 at 13:58 Comment(2)
how the heck did u know this? show us the source documentaiton?\Paget
This is actually wrong; it's the other way around (00000011 = Manual proxy, etc). See the accepted answer for more details. He says it's a bitfield with 0x2 = Manual proxy, this is the same as saying that you add 00000011 to your OR for Manual proxy (noting that the least significant bit is always 1 for this field)Nixon
G
-1
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Internet Explorer\Control Panel]
"Connection Settings"=dword:00000000
"Connwiz Admin Lock"=dword:00000000
"Autoconfig"=dword:00000000
"Proxy"=dword:00000000
"ConnectionsTab"=dword:00000000
Giesecke answered 6/3, 2014 at 18:49 Comment(0)
G
-1

I think you can change the "Automatically detect settings" via the registry key name "AutoConfigURL". here is the code that I check in c#. Wish you luck.

    RegistryKey registry = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true);
                    if(registry.GetValue("AutoConfigURL") != null)
                    {
                        //Proxy Server disabled (Untick Proxy Server)
                        registry.DeleteValue("AutoConfigURL");
                    }
Girdler answered 23/4, 2017 at 8:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.