Main Page
 The gatekeeper of reality is
 quantified imagination.

Stay notified when site changes by adding your email address:

Your Email:

Bookmark and Share
Email Notification
Project "AD Reporter"
Purpose
The purpose of this project is to demonstrate how to read all user and group objects contained in Active Directory using just ASP and perform auditing.

How I Approach This Project
The adReporter.asp file is set-up so that you can actually use it to monitor which users belong to groups in your Active Directory and, as well, get the Active Directory details on individual user objects. An additional feature is that you can enable Active Directory auditing which allows you to find out what objects were created (whether group or user) since the last time you accessed the webpage. As a webpage, it allows you to access such details in several ways (depending on how you want to expose adReporter.asp). Naturally you will probably want to require some type of authentication to the webpage if you want to be able to access it outside of your network (for example, though http or https in a web browser).

It should be so simple to use that the only things you will need to change are what is indicated below (in the adReporter.asp code). It is important to note that if you enable auditing the webpage will need to read/write/modify files that it creates for caching:

Server.ScriptTimeout = 320 ' Number of seconds to allow this script to run without spawning a server generated timeout message
Dim conMethod : conMethod = "WinNT" ' WinNT or LDAP
Dim adName : adName = "activedirectoryname" ' AD Name
Dim maxThreshold : maxThreshold = 1000 ' Maximum number of user records to work with in browser after initial index of users and groups they belong to is completed; too high a number results in out of memory browser error.
Dim ugDetect : ugDetect = "1" ' New AD Object Detection - If you wish to allow this script to record group and user objects to disk so that it can detect new objects being created, and tell you the the objects that have been created since it was last run, set this value to "1". Otherwise set to "0". If enabled, this detection may result in the page taking several minutes to load initially.
Dim frwLocation : frwLocation = Split(Server.MapPath("."), ":\")(0) & ":\"
frwLocation = frwLocation & "websites\adData\"
' Disk path to location where files containing users, groups and dates can be placed. Location must have read/write/modify permissions.
Dim adGroupResultsLabel : adGroupResultsLabel = "adGroupResults" ' ID of div which contains results of a group query
Dim adUserResultsLabel : adUserResultsLabel = "adUserResults" ' ID of div which contains results of a user query
adGroupsAutoCheck = Array() ' Contains list of groups to auto-check when user clicks the button
Redim Preserve adGroupsAutoCheck(0) : adGroupsAutoCheck(0) = "Domain Admins"  
Redim Preserve adGroupsAutoCheck(1) : adGroupsAutoCheck(1) = "Domain Users"  
Redim Preserve adGroupsAutoCheck(2) : adGroupsAutoCheck(2) = "Enterprise Admins"  


Download adReporter.asp (4kb Zip) HERE.
About Joe