On Your Own: Lab 26 Creating an ADO Query into Active Directory

In this lab, you will practice creating an ADO query into Active Directory to pull out information about computer objects.

Lab Instructions

  1. Open Notepad.exe.

  2. Type Option Explicit on the first line to force the declaration of all variables.

  3. Declare the following variables by using the Dim command: qQuery, objConnection, objCommand, and objRecordSet.

  4. Create a query using the LDAP namespace that connects to your local Domain Controller. Specify the objectCatagory that is equal to computer. Choose the following fields: distinguishedName, name, and logonCount. Set the search dimension to subtree. Assign this query to a variable called qQuery. Your code will look like the following:

    qQuery = ...

Get Microsoft® Windows® Scripting Self-Paced Learning Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.