Introduction
This article shows the easiest way of enumerating users for a domain or a specific machine using the standard ADSI calls. During enumeration, it gets the users generic information like Description, login id, etc. and the last logon time. The only API used in the entire code is GetComputerName, that too because the user might feel leaving the text box empty to enumerate users on the local machine.
Using the code
The code is written in vanilla VB and is very easy to understand. Please refer to msdn.microsoft.com for ADSI. The code is implemented into a single form which:
1. Enumerates the users on a specific domain/computer
2. Emits generic information and last logon information for the user to a CSV file (logons.csv)
3. Shows progress during the entire process
Points of Interest
I spent a lot of time on the net to search for something which achieves this. However most of the locations just gave me information for network API calls like NetUserEnum, etc. Which are great if you use C/C++, but are very troublesome if you plan to use them in VB. This articles shows you how easy it is to achieve all of this using ADSI.
History
Version: Original Version 1.0
Author: Parag Paithankar
Release date: 1-Mar-2005.