Skip to content


July 18, 2008

After writing the script that generates the lab usage report, I looked at the BuildArray procedure and decided to change it to be more generic. This would allow me to use it in different ways.

The QueryAD procedure is a very simple script that loops through a recordset of objects returned from the Active Directory. The procedure uses the strQuery variable to represent your LDAP query.

This procedure accepts one parameter:


The strQuery parameter represents the Active Directory query you wish to perform and should look similar to the following:

strQuery = "SELECT " & strPropertyList & " FROM ‘" & strLDAPURL & "’ WHERE objectClass = ‘" & strObjectClass & "’"

I have shown the assignment using variables to represent the significant portions of the query, you could certainly manually build the query, but this format allows for much more flexibility.


From → Scripting

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: