How can I determine which domain is the forest root domain?

John Savill

January 13, 2004

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

A. Determining which domain is the forest root domain isn't simple in all cases. In a forest with one tree, the domain at the top of the tree namespace is the tree root. However, if your forest has multiple trees, determining which tree root is the forest root isn't so easy--no simple GUI view can give you this information. However, you can identify the forest root by performing either of the following series of steps on a machine that's a member of the forest:

  1. Start Notepad and copy the following commands into the application:

    Set objSysInfo = CreateObject("ADSystemInfo")Wscript.Echo "Forest DNS Name: " & objSysInfo.ForestDNSName 
  2. Save the file as forestroot1.vbs.

  3. Exit Notepad, then double-click forestroot1.vbs in Windows Explorer.

  4. Windows will display the DNS name of the forest root.

Or

  1. Start Notepad and copy the following commands into the application:

    Set objRootDSE = GetObject("LDAP://RootDSE")Wscript.Echo "Root Domain: " & objRootDSE.Get("RootDomainNamingContext") 
  2. Save the file as forestroot2.vbs.

  3. Exit Notepad, then double-click forestroot2.vbs in Windows Explorer.

  4. Windows will display the distinguished name (DN) of the forest root.

Because both files are VBScript files, you can also use Cscript to run them from the command line. For example, when I type

cscript forestroot1.vbs

my computer returns the following information:

Microsoft (R) Windows Script Host Version 5.6Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.Forest DNS Name: savilltech.com

Likewise, when I type

cscript forestroot2.vbs

my computer returns the following information:

Microsoft (R) Windows Script Host Version 5.6Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.Root Domain: DC=savilltech,DC=com

A.

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