JSI Tip 10043. Which of my DNS zones are Active Directory integrated?

Using REG.EXE, built into Windows XP and Windows Server 2003 and later operating systems, or installed on Windows 2000 from the Support Tools on the Windows 2000 CD-ROM, I have scripted DSIntegrated.bat to display the DNS zone names that are Active Directory integrated.

The syntax for using DSIntegrated.bat, on any domain computer, is:

\[Call\] DSIntegrated \[LAN\]

Where LAN is optional name of your connection, like JSIINC. If not specified, it will default to Local Area Connection.

If you wanted to process the Active Directory integrated zones, use:

for /f "Tokens=*" %%z in ('DSIntegrated \[LAN\]') do (
 set Zone=%%z
 @echo !Zone!
 . . .
 . . .
DSIntegrated.bat contains:

@echo off
set LAN="Local Area Connection"
if \{%1\} NEQ \{\} set LAN=%1
set LAN=%LAN:"=%
set LAN=Ethernet adapter %LAN%:
set OK=N
set Zone=NONE
for /f "Tokens=*" %%a in ('IPCONFIG /ALL') do (
 set line=%%a
 for /f "Tokens=*" %%x in ('@echo %%a ^|find "Ethernet adapter "') do set OK=N
 for /f "Tokens=*" %%x in ('@echo %%a ^|find "%LAN%"') do set OK=Y
 if "!OK!" EQU "Y" for /f "Tokens=*" %%x in ('@echo %%a ^|find "DNS Servers . . . . . . . . . . . : "') do set DNSIP=!line:~36!
for /f "Tokens=*" %%a in ('reg query "\\%DNSIP%\HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DNS Server\Zones" /s') do (
 set line=%%a
 set work=!line:\DNS Server\Zones\=!
 if "!line!" NEQ "!work!" set Zone=!line:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DNS Server\Zones\=!
 if "!line!" EQU "DsIntegrated        REG_DWORD       0x1" @echo !Zone!
 for /f "Tokens=1,3" %%x in ('@echo %%a^|find /i "DsIntegrated"^|find /i "0X1"') do (
  @echo !Zone!

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.