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.
This is awesome! Is there a way to make it not interact with the “Use Proxy Server for your LAN” check box at all as opposed to ticking or un-ticking it?
Yes, there is. I have now included the breakdown of how to calculate the correct value in the post. Hope that helps.
Hi Guys, please have a look at the following blog post : http://blog.raido.be/?p=426
There is a registry value (non-binary) to control this setting. Upon reading it, Internet Explorer will change the binary value itself and delete the first registry value.
Thanks Frank, excellent write up. If I get a chance I will give your method a go.
Excellent! I love both methods but currently prefer Frank’s as it’s even simpler and more straightforward. I love being able to just run a REG ADD call and get this taken care of!
El Script funciono perfecto, SOS GROSSO!, SABELO!!!!
The script works perfectly, you are great! know-it!
Grettings from Chile
An informative post, thank you. Helped my understanding of this particular windows registry foible.
Hello, I finally found a way to set the “Automatically detect settings” in vbs. It might be the right or wrong way but it works for me.
Here is my post about it http://blogs.msmvps.com/mickyj/blog/2013/10/31/programmatically-alter-automatically-detect-settings-in-ie-through-vbs/
Thanks – i like the different approach. Will give it a try.
Excellent little script. Made testing and enforcing Auto settings in IE across multiple IE versions a breeze. Cheers.
If you need the Proxy Settings to remain ticked I used binValue(8) = 02.
This unchecks the first 2 boxes (Auto and Script) but leaves Proxy Settings still ticked.
Great Article / Script – fixed a major issue with IE through GPO.
Check this out.
http://fbinotto.blogspot.co.nz/2012/06/ie-gpo-automatically-detect-settings.html#!/2012/06/ie-gpo-automatically-detect-settings.html
Thanks Felipe.
Can’t remember why now, but I remember this setting not working for us. Very useful though, and a simpler solution to try first.
Hi Craig,
I think the reason it didn’t work for you is because either you used the 5th set or it wasn’t consistent.
I have made several scripts for this, most of them worked 90% of the time but sometimes would fail. Since I started using this particular script, it has worked 100% of the time.
I need to add the elevated level sub at the top of the script before it will work correct with Windows 7.
Good article, thank you for the info and the script! Just a quick note though – using “05” clears the “automatically detect settings” box, but enables the “use automatic configuration script” box. If you want them BOTH unchecked you should set the option to “01” instead.
Thanks mate. We were using auto config scripts – but good clarification for other users. Thanks for the tip.
AWESOME TOO. That was one reason I was having problems. I was looking for the key to turn Auto Config on but couldn’t find it. We use Auto Config where I work. One of my scripts would say, “The yada yada yada is already off if it was off but would say it was turned off if it was on. When I tested all senarios I used one of those off and one on and the message kept saying it turned one off but one was already off. Then sometimes it would toggle the switches. I thought it was my programming, instead it was correct just used the wrong number.
That’s what I love about the reputable programmers in the world. We are all willing to freely help each other out.
YOU ALL ROCK!!!