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

John Savill

April 30, 2006

1 Min Read
ITPro Today logo in a gray background | ITPro Today

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 hereset 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

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like