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

Posted on 2007-10-19
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 82

    Accepted Solution

    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;...):
    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
    LVL 7

    Author Comment

    works like a dream....

    great help, thanks...


    Featured Post

    Are your corporate email signatures appalling?

    Is it scary how unprofessional your email signatures look? Do users create their own terrible designs and give themselves stupid job titles? You can make this a lot easier for yourself by choosing an email signature management solution from Exclaimer today.

    Join & Write a Comment

    As the name suggests, SVCHost stands for Service Host. It is a process which hosts different services of Windows which are actually run from Dynamic Link Libraries (DLL) files. A DLL is a library that contains data (code) that could be used by mo…
    This is an article about Leadership and accepting and adapting to new challenges. It focuses mostly on upgrading to Windows 10.
    The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    728 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

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now