Skip navigation

How can I use a script to check the domain mode and forest mode of a client computer?

A. The script below, which you can download here will display the domain mode of a specified domain:

If Wscript.Arguments.Count 
Run the script by using the following command:
C:\temp>cscript showdomainmode.vbs savilltech.com


To check the forest mode, run the following script with no parameters to display the forest mode of the forest of the client that the script runs on. You can download the script here

set objRootDSE = GetObject("LDAP://RootDSE")
set objDomain = GetObject("LDAP://cn=partitions," & objRootDSE.Get("configurationNamingContext") )
if objDomain.Get("msDS-Behavior-Version") = 2 then
Wscript.Echo "Windows Server 2003"
ElseIf objDomain.Get("msDS-Behavior-Version") = 1 then
script.Echo "Windows 2003 Interim"
Else
Wscript.Echo "Windows 2000"
End If

Hide comments

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.
Publish