JSI Tip 10034. How can a script query if my domain is in mixed mode?

Using the Active Directory command-line tools, I have scripted IsMixed.bat to determine if your domain is running in mixed mode.

The syntax for using IsMixed.bat is:

\[Call\] IsMixed Mix DN


Mix is a call directed environment variable that will contain a:
    0 if the domain is NOT in mixed mode
    1 if the domain is mixed.

DN  is a call directed environment variable that will contain the domain's distinguished name.
NOTE: See How do I raise the domain and forest functional levels that are supported by Windows Server 2003 domain controllers?

NOTE: See How do I restrict the change to Native Mode function to 'Enterprise Admins'?

IsMixed.bat contains:

@echo off
if \{%2\}==\{\} @echo Syntax: IsMixed Mix DN&goto :EOF
set Mix=?
set qry=dsquery * domainroot -filter "(&(objectClass=DomainDNS))" -attr nTMixedDomain distinguishedName -limit 0
for /f "Skip=1 Tokens=1*" %%a in ('%qry%') do (
 set Mix=%%a
 set DN=%%b#
set DN=%DN:  =%
set DN=%DN: #=%
set DN=%DN:#=%
endlocal&set %1=%Mix%&set %2=%DN%

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.