VB Scripting

G

Guest

I'm connecting to our AD database using the following statements in a VB
Script to pull out the user name and phone number:

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


objCommand.Properties("Sort On") = "Name"
objCommand.CommandText = "<LDAP://MY_DOMAIN>;(objectCategory=user)" &
";ADsPath,Name,telephoneNumber;subtree"

Set objRecordSet = objCommand.Execute

It all appears to work ok, but when I check the logs from the script it
appears to only be searching through the first 1000 users in the database.
Can anyone tell me if there's a limit to how many users you can search
through using the above command? Or, does anyone have any other ideas on
what's happening?

Any help is appreciated
 
T

Tomasz Onyszko

Mat said:
I'm connecting to our AD database using the following statements in a VB
Script to pull out the user name and phone number:

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


objCommand.Properties("Sort On") = "Name"
objCommand.CommandText = "<LDAP://MY_DOMAIN>;(objectCategory=user)" &
";ADsPath,Name,telephoneNumber;subtree"

Set objRecordSet = objCommand.Execute

It all appears to work ok, but when I check the logs from the script it
appears to only be searching through the first 1000 users in the database.
Can anyone tell me if there's a limit to how many users you can search
through using the above command? Or, does anyone have any other ideas on
what's happening?

Any help is appreciated

You have to turn on results paging for your results - this can be doen
by specyfing a number on records in one page:

objCommand.Properties("Page Size") = 1000
 
G

Guest

Thanks Tomasz, that worked a treat!

Tomasz Onyszko said:
You have to turn on results paging for your results - this can be doen
by specyfing a number on records in one page:

objCommand.Properties("Page Size") = 1000
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Top