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 ?
This question is related to
internet-explorer
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
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");
}
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.
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.
You can always just export the registry, change the setting, then export the registry again and do a diff.
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
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
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:
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.
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
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 ).
Source: Stackoverflow.com