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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I know the users logged on to a network

Status
Not open for further replies.

FaneDuru

Technical User
Jul 15, 2002
141
RO
Is there an API or something else being able to give me a list with the users logged on to a speciffic domain in a Local Area Network ?

Thanks !
Fane Duru'
 
I think you can use this API:

Declare Function NetUserGetInfo Lib "netapi32" (ByVal servername As String, ByVal username As String, ByVal level As Long, bufptr As Long) As Long

You should check the with this website:
Great resource for API's.

Patrick.
 
Thanks, Patrick !
I don't know how to use the API for enumerating of logged computers. I am able to see the all users (or computers) which logged on today, but I don't know if they are still logged. I do that with the code:

Sub Logged_Users()
Dim DomainObj As Object, Domeniu As String
Domeniu = "icmrom"
Set DomainObj = GetObject("WinNT://" & Domeniu)
DomainObj.Filter = Array("user")
'DomainObj.Filter = Array("computer")
For Each UserObj In[/color] DomainObj
On Error Resume Next
If Day(UserObj.LastLogin) = Day(Date) And _
Month(UserObj.LastLogin) = Month(Date) And _
Year(UserObj.LastLogin) = Year(Date) Then
Debug.Print UserObj.Name
End If
On Error GoTo 0
Next

MsgBox "OK !", , "Finished job !"
End Sub

Using "DomainObj.Filter = Array("computer")" I obtain a list with computers logged on......
Is there a way to see only the ones logged on at a specific time ?
I tried to use &quot;UserObj.LastLogOff&quot; like beeng < then &quot;UserObj.LastLogin&quot; but untortunatelly there are recorded only the logging off which have been done without closing the computer......

Thanks, anyhow,
Fane Duru'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top