Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Capture Domain Logon ID

Status
Not open for further replies.

RayLee

Programmer
Jan 29, 2001
6
HK
I'm writing an attendence program and facing a problem on capture domain logon ID. It is an EXE program that installed on the PDC. When a user logon domain, it will execute a batch file on doing somethings first and then run this logon program to capture logon ID and server logon time. Can anyone tell me how to capture the logon ID from PDC in VB Coding. Thanks!

Regards,
Ray
 
I don't know if you can hook directly into the PDC's security layer the way you are saying and even if you could, I don't know that you'd want to (the security APIs will give any programmer a headache to end all headaches . . . I'm still recovering from my encounter).
What I would do if I were you would be to have the user's Login Script run an executable. This executable would run on the user's machine and it would use some basic APIs to get local user name, machine name, time, and date (etc etc). This data would then be recorded to a database somewhere (perhaps a small DB located on the PDC or anywhere else on you network). This would give a complete log of who is logging in, where they are logging in from, and what time they are logging in at. If you want to know what APIs you will need to get the machine name and user name, just let me know and I will look them up for you. They are pretty easy to use however.
 
Here are the APIs that you will want to use . . .


Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Public Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long


Hope these help . . .

- Jeff Marler
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top