Active Directory – Page Pool Size

Have you ever created a script that wouldn’t return all of the results you expected? Often times this is caused by a default Active Directory value (MaxPageSize). Initially this value is set to 1000, so when you query Active Directory only 1000 results will be returned. You can change this value through ntdsutil.exe but I recommend the following.

When configuring your ADODB command use the following property:

    objCommand.Properties(”Page Size”) = 10000

As you can see I set the Page Size value to 10000 because I know that the Active Directory I’m pulling values from will never return more than 10000. You can set this depending on the size of your environment, or to the maxint value if you’re not sure. An example follows the break.

Here is the example;

I am creating the ADODB connection/command and specifying the Page Size. You can also see me use this here.

... 

Set objConnection = CreateObject("ADODB.Connection")             

    objConnection.Provider = "ADsDSOObject"             

    objConnection.Open "Active Directory Provider"             

Set objCommand = CreateObject("ADODB.Command")             

Set objCommand.ActiveConnection = objConnection                

    objCommand.Properties("Page Size") = 10000             

    objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE

...

Please feel free to comment if you have any questions. I hope this has helped.

No Comments yet »

RSS feed for comments on this post. TrackBack URI

Leave a comment

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Powered by WordPress with [GimpStyle]
Entries and comments feeds.