JSI Tip 10463. What is the mode of my domain?

Using only native commands, I have scripted DomainMode.bat to determine if my domain is running in one of the following modes:

Windows Server 2003
Windows 2003 Interim
Windows 2000 mixed
Windows 2000 native
The syntax for using DomainMode.bat is:

\[Call\] DomainMode Domain.com Mode


Domain.com is the domain name, like JSIINC.COM.

Mode       is a call directed environment variable that will contain the Mode of the Domain.com domain.
NOTE: See What is the mode of the forest that the domain I am logged onto is a member of?

DomainMode.bat contains:

@echo Off
if \{%2\}==\{\} @echo Syntax: DomainMode Domain.com Mode&goto :EOF
if exist "%TEMP%/DomainMode.vbs" goto doit
@echo.domain = Wscript.Arguments(0)>"%TEMP%/DomainMode.vbs"
@echo.set objDom =  GetObject("LDAP://" ^& domain)>>"%TEMP%/DomainMode.vbs"
@echo.if objDom.Get("msDS-Behavior-Version") = 2 then>>"%TEMP%/DomainMode.vbs"
@echo.  Wscript.Echo "Windows Server 2003">>"%TEMP%/DomainMode.vbs"
@echo.ElseIf objDom.Get("msDS-Behavior-Version") = 1 then>>"%TEMP%/DomainMode.vbs"
@echo.  Wscript.Echo "Windows 2003 Interim">>"%TEMP%/DomainMode.vbs"
@echo.  If objDom.Get("nTMixedDomain") = 1 Then>>"%TEMP%/DomainMode.vbs"
@echo.    Wscript.Echo "Windows 2000 mixed">>"%TEMP%/DomainMode.vbs"
@echo.  Else>>"%TEMP%/DomainMode.vbs"
@echo.    Wscript.Echo "Windows 2000 native">>"%TEMP%/DomainMode.vbs"
@echo.  End If>>"%TEMP%/DomainMode.vbs"
@echo.End If>>"%TEMP%/DomainMode.vbs"
for /f "Tokens=*" %%m in ('cscript //nologo "%TEMP%/DomainMode.vbs" %1') Do (
 set %2=%%m

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.