Problem with total number of results returned

Discussion in 'Scripting' started by JR Bowne, Jan 20, 2005.

  1. JR Bowne

    JR Bowne Guest

    The following script was pieced together from technet but when I run it, it
    only returns 24 results each time. I'm wracking my brain as to why. BTW, I
    am not a coding guru so any and all help would be appreciated.

    ____________SCRIPT FOLLOWS_____________

    Const ADS_UF_ACCOUNTDISABLE = 2

    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.CreateTextFile("c:\scripts\disabled.txt")

    Set objConnection = CreateObject("ADODB.Connection")
    objConnection.Open "Provider=ADsDSOObject;"

    Set objCommand = CreateObject("ADODB.Command")
    objCommand.ActiveConnection = objConnection

    'objCommand.CommandText = "<GC://dc=jhhs,dc=org>;(objectCategory=User)" &
    ";userAccountControl,distinguishedName;subtree"
    objCommand.CommandText =
    "<GC://dc=corp,dc=jhhs,dc=org>;(objectCategory=User)" &
    ";userAccountControl,distinguishedName,name;subtree"

    Set objRecordSet = objCommand.Execute

    intCounter = 0

    While Not objRecordSet.EOF
    intUAC=objRecordset.Fields("userAccountControl")
    If intUAC And ADS_UF_ACCOUNTDISABLE Then
    objFile.WriteLine objRecordset.Fields("distinguishedName")
    ' objFile.WriteLine objRecordset.Fields("name")
    intCounter = intCounter + 1
    End If
    objRecordset.MoveNext
    Wend

    WScript.Echo Vbcrlf & "A total of " & intCounter & " accounts are disabled."

    objFile.Close

    objConnection.Close
     
    JR Bowne, Jan 20, 2005
    #1
    1. Advertisements

  2. What result would you expect? Why is 24 the wrong result?

    On Thu, 20 Jan 2005 08:27:07 -0800, "JR Bowne" <JR
     
    Corné Bogaarts, Jan 21, 2005
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.