0
여기서 내가 잘못 될 부분을 이해하려고합니다. 다음 스크립트는 항상 배열의 끝에 빈 항목을 반환합니다. 왜? 나는 그것이 레코드 세트에 문제가 있다고 생각하지 않는다. 어떤 아이디어?연결 및 분할 반환 ubound (array) + 1 items
function allServers
Set adoCommand = CreateObject("ADODB.Command")
Set adoConnection = CreateObject("ADODB.Connection")
adoConnection.Provider = "ADsDSOObject"
adoConnection.Open "Active Directory Provider"
Set adoCommand.ActiveConnection = adoConnection
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
strBase = "<LDAP://" & strDNSDomain & ">"
strFilter = "(&(objectCategory=computer)(operatingsystem=*server*)(!userAccountControl:1.2.840.113556.1.4.803:=2))"
strAttributes = "name,distinguishedname,dnshostname"
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
adoCommand.CommandText = strQuery
adoCommand.Properties("Page Size") = 100
adoCommand.Properties("Timeout") = 30
adoCommand.Properties("Cache Results") = False
Set adoRecordset = adoCommand.Execute
dim strList, i
Do Until adoRecordset.EOF
strList = strList & adoRecordSet.Fields("name").Value & ","
adoRecordset.MoveNext
loop
adoRecordset.Close
adoConnection.Close
arr = split(strList, ",",-1,1)
allServers = arr
end function
arr = allservers
For i = 0 to UBound(arr)
wscript.echo i & ":" & arr(i)
next
답장을 보내 주셔서 감사합니다. 루프에서 값을 지정하기로했습니다. Active Directory 공급자가 .Count를 지원하지 않는 것 같습니다. – yajohn