Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

determine a forest name

Status
Not open for further replies.

twayd

MIS
May 5, 2008
14
0
0
US
hey all - i'm looking for the easiest way to determine the forest name in a AD environment. thanks in advance!!
 
Here's two ways (from WindowsIT Pro):
Start Notepad and copy the following commands into the application:
Set objSysInfo = CreateObject("ADSystemInfo")
Wscript.Echo "Forest DNS Name: " & objSysInfo.ForestDNSName
Save the file as forestroot1.vbs.
Exit Notepad, then double-click forestroot1.vbs in Windows Explorer.
Windows will display the DNS name of the forest root.

Or

Start Notepad and copy the following commands into the application:
Set objRootDSE = GetObject("LDAP://RootDSE")
Wscript.Echo "Root Domain: " & objRootDSE.Get("RootDomainNamingContext")
Save the file as forestroot2.vbs.
Exit Notepad, then double-click forestroot2.vbs in Windows Explorer.
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.6
Copyright (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.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

Root Domain: DC=savilltech,DC=com

I hate all Uppercase... I don't want my groups to seem angry at me all the time! =)
- ColdFlame (vbscript forum)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top