Jump to content
Sign in to follow this  

Users on a Server - Log in and out

Recommended Posts


I am trying to find a way to find out when someone logs onto a server in real-time

while I am in the server working. This is what I have so far. It works and tells me

who has just logged in. But, I can not figure a way to let me know who has just logged

out. The logged in is easy because it will the last user in the list. Logging out is a little

more complicated because i need to probably compare arrays for differences, which is

where I am weak. Also, I need to keep the task manager opened, minimized, with the

user tab in focus for this to work (not the best of solutions).

I am looking to see if this is the best way to approach this and/or is there something

already out there that is available that I missed?


#Include <GuiListView.au3>

#include <Date.au3>


HotKeySet("+{ESC}", "Terminate")

WinSetState ( "Windows Task Manager", "Users", @SW_MINIMIZE )

while 1

$count1 = ControlListView ( "Windows Task Manager", "Users", 3002, "GetItemCount")



While not WinExists("Windows Task Manager", "Users")



$count2 = ControlListView ( "Windows Task Manager", "Users", 3002, "GetItemCount")

Until $count1 <> $count2


if $count1 > $count2 Then

MsgBox(4160,"Logout", "A user logged out at: " & _NowTime())


$user = ControlListView ( "Windows Task Manager", "Users", 3002, "GetText", $count2 - 1, 0)

MsgBox(4160,"New User", "The user " & $user & " logged in at: " & _NowTime())



Func Terminate()




Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.