Assumptions
===========
- you are logged on to domain STAFF at a computer that is member of STAFF
- you are listing the other domain STUDENT which together with STAFF belong to the
forest MAIN.SOMECOLLEGE.EDU
( STAFF.MAIN.SOMECOLLEGE.EDU, STUDENT.MAIN.SOMECOLLEGE.EDU, MAIN.SOMECOLLEGE.EDU )
VBscript list.vbs
=================
yourDomain = "GC://main.somecollege.edu/DC=student,DC=main,DC=somecollege,DC=edu"
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.CommandText = "select cn from '" & yourDomain & "' where objectClass='group'"
objCommand.Properties("Page Size") = 500
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
wscript.echo objRecordSet.Fields("cn").Value
objRecordSet.MoveNext
Loop