Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Getting Logon times for users on a Domain/Computer

0.00/5 (No votes)
28 Feb 2005 1  
An article on getting user logon times for a specific domain or computer

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.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here