Skip to content

QueryAD

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:

strQuery

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.

Advertisements

From → Scripting

Leave a Comment

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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: