How to List Domain Controllers in domain 
Author Message
 How to List Domain Controllers in domain

Any ideas on how to list all of the domain controllers in a specific domain?

Tue, 03 Feb 2004 21:55:28 GMT  
 How to List Domain Controllers in domain

Use WMI.

TIP1: Before asking questions that most likely has been asked before, do a
newsgroup search.
You can use to search in a news
database having articles dated back to all the way to 1995.

TIP2: When you have the Google search results in a browser window, drag and drop
each thread (the link that says "View Thread" in a ANOTHER browser window. This
way you don't have to wait for the search result to be reloaded each time you
have looked at a thread.

For your question:

Fill in eg. the following words in the "Find messages with all of the words"
field:  get domain controller

Fill in *scripting in the Newsgroup field to narrow down the search to the
scripting groups only!

Then read and learn :-) Attached is one example I found that you can play with.



Subject: Re: Listing Servers and Shares in an NT Domain
Newsgroups: microsoft.public.scripting.wsh
Date: 2001-03-23 16:16:08 PST

The following code will give you all the information you are looking for.
You will have to have WMI on your servers.

The code below makes NO decisions on when to display stuff or what to
process, but it will dump all the information it can to the screen.  You can
then make whatever changes you need to get the script to work best for you.


On Error Resume Next


Set WbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set oDomain = GetObject("WinNT://" & DOMAIN & ",domain")
oDomain.Filter = Array("Computer")

for each oComputer in oDomain
  Set oUser = GetObject("WinNT://" & DOMAIN & "/" & oComputer.Name & "$,user")

  lngFlags = oUser.Get("UserFlags")
  if ( ( lngFlags AND 8192 ) = 8192 ) then
    wscript.echo oComputer.Name & " is a domain controller."
    wscript.echo oComputer.Name & " is a member server or workstation."
  end if

  Set WbemService = WbemLocator.ConnectServer(oComputer.Name)
  Set WbemEnumerator = WbemService.ExecQuery("Select * From
  for each WbemInstance In WbemEnumerator
    wscript.echo vbTab & "OS: " & Left( WbemInstance.Name,
Instr(WbemInstance.Name, "|" ) - 1 )

  wScript.echo vbTab & "Flags: " & lngFlags
  Set oServer = GetObject("WinNT://" & DOMAIN & "/" & oComputer.Name &
  for each oShare in oServer
    wscript.echo vbTab & oShare.Name & " = " & oShare.Path




> Any ideas on how to list all of the domain controllers in a specific domain?

Wed, 04 Feb 2004 02:41:59 GMT  
 [ 2 post ] 

 Relevant Pages 

1. domain pruefen domain provider es domain registrieren domain angebot no domain

2. domaene sichern de tc domain domain registrieren preisvergleich kostenlose toplevel domain de domain preis

3. plesk domain anmeldung domaene langsam anmeldung an domain de domain kaufen domain suchen

4. HELP: Listing domains and computers in the domains

5. Changing Domain Controller (nltest /sc_reset)

6. Creating a new user on Active Directory enabled domain controller

7. Validate an account on a WinNT Domain controller

8. Validate an account on a WinNT Domain controller

9. KeyCodeV2.dll problems on domain controller, deploys fine on other machines

10. Validate an account on a WinNT Domain controller

11. Validate an account on a WinNT Domain controller

12. Returning Domain Name Controller Server


Powered by phpBB® Forum Software