Dan,
I use the IADs tools from the W2k support tools - it is very nice to put
into a script. The following is a code snip to query AD for all of the DC
names and then ping them. There is a iadstools.doc that comes with the
support tools that has a fair writeup...
Start*****
Set objIADS=CreateObject("IADsTools.DCFunctions")
objIADS.EnableDebugLogging(3)
dc_count = objIADS.DsGetDcList(cstr(srcsvr),CStr(domain))
wscript.echo "Number of domain controllers found: " & dc_count
write_log ("Number of domain controllers found: " & dc_count)
For i = 1 to dc_count
wscript.echo "-----------------------------------------------"
write_log ("-----------------------------------------------")
wscript.echo "NetBios name: " & objiads.dclistentrynetbiosname(i)
write_log ("NetBios name: " & objiads.dclistentrynetbiosname(i))
cmd_line = "cmd /c ping " & objiads.dclistentrynetbiosname(i)
Set objShell = wscript.createobject("wscript.shell")
Set objExecObject = objShell.Exec(cmd_line)
Do Until objExecObject.StdOut.AtEndOfStream
output_line = objExecObject.StdOut.ReadLine()
wscript.echo output_line
write_log (output_line)
Loop
Next
End*****
Srcsvr is the DC that you query to get the list of DCs. I generally use the
FSMO role holder. Domain is the DNS domain name of the domain that you want
to query. Both of these have to be cast to string variables in VBS (cstr...)
DCListEntryIsPDC() should indicate which one is the PDC role holder but you
would need to test this - I never have used this part of the return data...
I use this a lot in scripts so I don't have to keep up with a manual list of
DCs for the various domains that I am chasing after - it is pretty handy.
FWIW - Frank
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Dan Boghici
Sent: Sunday, December 26, 2004 9:20 AM
To: [email protected]
Subject: [ActiveDir] domain controller name
Hi,
Sorry if this has been asked.
Is there a command that can give me the domain controller's names or ip
addresses? And if there is will that tell me witch of that domain controller
is the primary one and witch is the secondary?
Thanks,
Dan
List info : http://www.activedir.org/mail_list.htm
List FAQ : http://www.activedir.org/list_faq.htm
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/
List info : http://www.activedir.org/mail_list.htm
List FAQ : http://www.activedir.org/list_faq.htm
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/