Create a custom ADM template for NT4 Policy Editor to configure the auto configuration setting in internet explorer.

Posted on 2007-10-19
Medium Priority
Last Modified: 2013-12-28
I've got an NT4 domain environment, with users workstations being either Windows 2000 or Windows XP, running IE6. I need to create a custom adm template to use within policy editor to configure the PC to use Automatically Detect Settings and not to use a proxy server...

Question by:DenisCooper
LVL 85

Accepted Solution

oBdA earned 2000 total points
ID: 20111844
You can use the adm template below to configure the proxy settings, but it's not possible with such a template to change the "Automatically detect settings" setting, as this is hidden in some binary data wich can't be handled with a template.
To change this setting, you can use the script below instead; when run without arguments, it will list the current state, and you can run it with the argument /on or /off to force the setting (it won't write to the registry if the setting stays the same). The script won't run on NT4.
As usual, try it with a test user first.


CATEGORY !!AdditionalSettings

  CATEGORY !!InternetExplorer

    POLICY !!ProxyConnect
      KEYNAME "Software\Microsoft\Windows\CurrentVersion\Internet Settings"

      PART !!ProxyEnable CHECKBOX
        VALUENAME "ProxyEnable"
      END PART

      PART !!ProxyServer TEXT END PART
      PART !!ProxyString TEXT END PART
        VALUENAME "ProxyServer"
      END PART

      PART !!ProxyOverride TEXT END PART
        VALUENAME "ProxyOverride"
        DEFAULT "<local>"
      END PART

    END POLICY ; ProxyConnect

  END CATEGORY ; InternetExplorer


AdditionalSettings=Additional Settings
InternetExplorer=Internet Explorer
ProxyConnect=Set Proxy Server
ProxyEnable=Enable Proxy Server
ProxyServer=Proxy Server (Format: protocol=proxy:port;...):
ProxyString=(Example: ftp=proxy.domain.com:80;http=proxy.domain.com:80)
ProxyOverride=Proxy Override (use ";" to separate entries):

@echo off
setlocal enabledelayedexpansion
set TempInFile=%Temp%\%~n0-In.tmp
set TempOutFile=%Temp%\%~n0-Out.tmp

regedit.exe /e "%TempInFile%" "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections"
for /f "tokens=1,3 delims=:[]" %%a in ('type "%TempInFile%" ^| find /n /i "DefaultConnectionSettings"') do (
  set LineNumber=%%a
  set BinLine=%%b
set Bin0=%BinLine:~0,11%
set /a Counter=0x%BinLine:~12,2%
set Bin1=%BinLine:~15,8%
set /a BitMask=0x%BinLine:~24,2%
set Bin2=%BinLine:~27%
set /a AutoDetect = "BitMask & 8"
if %AutoDetect% GTR 0 (set AutoDetect=On) else (set AutoDetect=Off)
echo Internet connection setting "Automatically Detect Settings"
echo Current state of Change counter: %Counter%
echo Current state of Auto Detect:    %AutoDetect% [%BitMask%]
if /i "%~1"=="/on" (
  set /a NewBitMask = "BitMask | 8"
  set AutoDetect=On
  goto WriteBack
if /i "%~1"=="/off" (
  set /a NewBitMask = "BitMask & 247"
  set AutoDetect=Off
  goto WriteBack
echo Use the command line switches /on or /off to turn on or off auto detection.
goto leave

if "%NewBitmask%"=="%BitMask%" (
  echo No change in state.
  goto leave
echo New state of Change counter: %Counter%
echo New state of Auto Detect:    %AutoDetect% [%BitMask%]
set /a Counter += 1
call :Dec2Hex BitMask
call :Dec2Hex Counter
>"%TempOutFile%" echo Windows Registry Editor Version 5.00
>>"%TempOutFile%" echo.
>>"%TempOutFile%" echo [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections]
>>"%TempOutFile%" echo "DefaultConnectionSettings"=hex:%Bin0%,%Counter%,%Bin1%,%NewBitMask%,%Bin2%
for /f "skip=%LineNumber% delims=" %%a in ('type "%TempInFile%"') do (
  set Line=%%a
  if "!Line:~0,2!"=="  " (>>"%TempOutFile%" echo !Line!) else (goto ChangeRegistry)
regedit /s "%TempOutFile%"
if exist "%TempOutFile%" del "%TempOutFile%"
del "%TempInFile%"
goto :eof

set Dec2Hex0=0
set Dec2Hex1=1
set Dec2Hex2=2
set Dec2Hex3=3
set Dec2Hex4=4
set Dec2Hex5=5
set Dec2Hex6=6
set Dec2Hex7=7
set Dec2Hex8=8
set Dec2Hex9=9
set Dec2Hex10=a
set Dec2Hex11=b
set Dec2Hex12=c
set Dec2Hex13=d
set Dec2Hex14=e
set Dec2Hex15=f
set Dec=!%1!
set /a Hi = "(Dec & 255) / 16"
set /a Lo = "Dec %% 16"
set %1=!Dec2Hex%Hi%!!Dec2Hex%Lo%!
goto :eof

Author Comment

ID: 20111907
works like a dream....

great help, thanks...


Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
IF you are either unfamiliar with rootkits, or want to know more about them, read on ....
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question