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=*));" &_
"displayName,extensionAttribute6,legacyExchangeDN;subtree"

Set objRecordSet = objConnection.Execute(strLDAP)
MsgBox objRecordSet.RecordCount,0,"COUNT"
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
   temp1=objRecordSet.Fields("displayName")
      temp2=objRecordSet.Fields("extensionAttribute6")
      temp3=objRecordSet.Fields("legacyExchangeDN")
      objFileHandle.WriteLine(temp1 & ";" & temp2 & ";" & temp3)
      objRecordSet.MoveNext
Loop

Can someone show me the code for an alternate method to get the data from a large database.
Thanks in advance
bleekAsked:
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.

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

http://support.microsoft.com/kb/888249/en-us


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

http://support.microsoft.com/?kbid=315071


Let me know.
0
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.
0
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?
0
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"&_
   ",dc=dc2,dc=dc3,dc=dc4,dc=dc5l>;(&(!objectCategory=computer)(displayName=*)(extensionAttribute6=*)(legacyExchangeDN=*));displayName,extensionAttribute6,legacyExchangeDN;subtree"
 Set objRecordSet = objCommand.Execute
 objRecordSet.MoveFirst
 MsgBox "Finished search"
 Do Until objRecordSet.EOF
   objFileHandle.WriteLine(objRecordSet.Fields("displayName") & ";" & objRecordSet.Fields("extensionAttribute6") & ";" & objRecordSet.Fields("legacyExchangeDN"))
   objRecordSet.MoveNext
 Loop  


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.
0
GranModCommented:
Closed, 350 points refunded.
GranMod
The Experts Exchange
Community Support Moderator of all Ages
0

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.