清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
Dim RootDSE, DomainNC, Connection, Command, RecordSet
' BEGIN CALLOUT A
Set RootDSE = GetObject("LDAP://rootDSE")
DomainNC = RootDSE.Get("defaultNamingContext")
' END CALLOUT A
Set Connection = CreateObject("ADODB.Connection")
Connection.Open("Provider=ADsDSOObject;")
Set Command = CreateObject("ADODB.Command")
Command.ActiveConnection = Connection
' BEGIN CALLOUT B
Command.CommandText = "<LDAP://" & DomainNC _
& ">;(objectCategory=Computer);CN;subtree"
' END CALLOUT B
Command.Properties("Cache Results") = False
Command.Properties("Page Size") = 100
Command.Properties("Sort On") = "CN"
Command.Properties("Timeout") = 30
Set RecordSet = Command.Execute()
' BEGIN CALLOUT C
Do While Not RecordSet.EOF
WScript.Echo RecordSet.Fields("CN").Value
RecordSet.MoveNext()
Loop
' END CALLOUT C
Connection.Close()