'# From the book "Managing Enterprise Active Directory Services"
'# ISBN: 0-672-32125-4
Dim dc, site, user, passwd, server, sites_dn, ntds_dn, ldapObj
Dim ntdsObj, connObj, serverObj, count, nc_count, gen
' DC Information
dc = "dc2"
site = "RTP"
' Authentication Information
user = "administrator@xyz.com"
passwd = "password"
server = "dc1"
sites_dn = "cn=sites,cn=configuration,dc=xyz,dc=com"
ntds_dn = "cn=ntds settings,cn=" & server & ",cn=servers,cn=" _
& site & "," & sites_dn
Set ldapObj = GetObject("LDAP:")
Set ntdsObj = ldapObj.OpenDsObject("LDAP://" & server & "/" & ntds_dn, _
user, passwd, 1)
ntdsObj.Filter = Array("ntdsConnection")
count = 0
For Each connObj in ntdsObj
count = count + 1
Wscript.Echo "Name: " & connObj.cn
Set serverObj = ldapObj.OpenDsObject(ntdsObj.Parent, user, passwd, 1)
Wscript.Echo " Server: " & serverObj.Get("dnshostname")
' ms-DS-ReplicatesNCReason is a DNWithBinary so the IadsDNWithBinary
' interface must be used to get at the values
nc_count = 0
For Each DNWithBinary In connObj.Get("ms-DS-ReplicatesNCReason")
nc_count = nc_count + 1
Wscript.Echo " NC " & nc_count & ": " & DNWithBinary.DNString
Next
If connObj.options = 1 Then
gen = "AUTO"
Else
gen = "YES"
End If
Wscript.Echo " Generated: " & gen
Next
|