Active Directory export exceeds 1000 records

Here's the script I have.  It works until it reaches 1000 records then it quits.

strDomain = InputBox("Input Domain Name")
strFile = strDomain & "Mailbox.txt"
set objFso = wscript.createObject("Scripting.FileSystemObject")
set objFileHandle = objFso.OpenTextFile(strFile,2,"True")

Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "ADs Provider"
strLDAP="<GC://dc=one,dc=two,dc=com>;(&(objectCategory=person)(objectClass=user)(displayName=*));" &_

Set objRecordSet = objConnection.Execute(strLDAP)
MsgBox objRecordSet.RecordCount,0,"COUNT"
Do Until objRecordSet.EOF
      objFileHandle.WriteLine(temp1 & ";" & temp2 & ";" & temp3)

Can someone show me the code for an alternate method to get the data from a large database.
Thanks in advance
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

This seems to be an issue no matter what tool is used:

You can try to increase the MaxPageSize within the AD using NTDSUTIL:

Let me know.
bleekAuthor Commented:
I don't have the privilege to increase the size.  I can suggest it to the powers that be.  Thanks for the quick response.
bleekAuthor Commented:
Someone told me that there is a way to enable paging in the search so that you don't have to increase the MaxPageSize (which was turned down in no uncertain terms!).  Can anyone help me with the code to do this?
bleekAuthor Commented:
I found the solution:  

  Set objConnection = CreateObject("ADODB.Connection")
  Set objCommand = CreateObject("ADODB.Command")
  objConnection.Provider = "ADsDSOObject"
  objConnection.Open "Active Directory Provider"
  Set objCommand.ActiveConnection = objConnection
  objCommand.ActiveConnection = objConnection

  objCommand.Properties("Page Size") = 900
  objCommand.Properties("SearchScope") = ADS_SCOPE_SUBTREE
  objCommand.Properties("Timeout") = 1200

  objCommand.CommandText = "<GC://dc=dc1"&_
 Set objRecordSet = objCommand.Execute
 MsgBox "Finished search"
 Do Until objRecordSet.EOF
   objFileHandle.WriteLine(objRecordSet.Fields("displayName") & ";" & objRecordSet.Fields("extensionAttribute6") & ";" & objRecordSet.Fields("legacyExchangeDN"))

The important thing is to set the page size < 1000 and set a timeout value large enough so that it won't timeout.

If nobody has any objections, I will ask to have the question closed and the points refunded.  I'll wait 1 week to give people time.
Closed, 350 points refunded.
The Experts Exchange
Community Support Moderator of all Ages

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2003

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.