Solved

Getting NT Status - logged on / off or locked

Posted on 2000-04-12
13
171 Views
Last Modified: 2013-11-20
How can I tell if a computer has someone logged in? I need to write a program that tells if someone is at their desk, the idea being that if they are, they're most likely to also be logged in and not be logged out or locked. I need a "yes" answer from the program for a logged in and a "no" answer for any other state. I can then write this to a web page in my usual way.

Cheers

Dave
0
Comment
Question by:wierd_dave
  • 5
  • 4
  • 2
  • +2
13 Comments
 
LVL 4

Expert Comment

by:inpras
ID: 2707477
I think U need to have an adapater installed on the end m/c which monitors the events on the end m/c logs them and sends to server (for this U can use sockets)..
Hope this helps
0
 
LVL 3

Accepted Solution

by:
shaig earned 200 total points
ID: 2707532
What if a user is logged in, but away from his computer?

Try a different view:
Detect keyboard and mouse events. If idle for more then a defined time, then declare user as 'away'.   ICQ uses a simulare mechanism.

You can implement this using Win32 hooks.
0
 

Author Comment

by:wierd_dave
ID: 2707572
I can handle him being away! I'm having to put up with an endless stream of students looking for a certain research assistant, so if I can put whether he's in or not on a web page, I'll be a happy chappie.

Would the computer being locked affect the operation of a program?

Dave
0
 
LVL 86

Expert Comment

by:jkr
ID: 2707583
The most compatible way for all MS platforms would be to enumerate the entries in 'HKEY_USERS' - see http://www.sysinternals.com/misc.htm#loggedon for a source code sample...
0
 

Author Comment

by:wierd_dave
ID: 2707863
Looking at this program, it only checks if the computer has a user loged in or not, ragardless of whether it is locked or not. We very rarely log off in this office, preferring to lock so we can still access each others resources.
A locked machine is the best indication that we are not in.
If it's not locked and unused, we've popped to the coffee machine.
If it's logged out, we're probably rebooting or logging back in as an administrator.
If it's locked we've left the building for whatever reason.
0
 
LVL 86

Expert Comment

by:jkr
ID: 2707998
Err - your question was "How can I tell if a computer has someone logged in?".

My answer was the answer to this very question... It's not good practice here to ask questions, reject correct answers along with telling 'no, I wanted to know something else'
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

Author Comment

by:wierd_dave
ID: 2708365
OK, I don't appear to have been as clear as I thought I had been. When I said "I need a "yes" answer from the program for a logged in and a "no" answer for any other state." I meant that if the machine is logged in and not locked, then I can assume someone is sat there working. If it is logged off or is logged in to, but has been locked, they probably are not working here.

I know what I meant, I just didn't say it quite right.

Dave
0
 
LVL 3

Expert Comment

by:shaig
ID: 2708775
I still think this is a bad mechanism.
The best way to tell if a user is using his compuetr is to check just that: keyboard and mouse activity.

How does the suggested mechanizm deal with a user that shuts his computer down (vecation, sick, etc.).
0
 

Author Comment

by:wierd_dave
ID: 2708813
I'm working on this activity monitor right now. If the mouse hasn't moved or the keyboard been touched in 15 minutes say, I'll log him as been out.
If he logs out the program will recieve a quit message and he can be instantly log as away.
Indeed it seems simpler this way.
0
 
LVL 3

Expert Comment

by:shaig
ID: 2708841
Yap, thats the idea.
0
 
LVL 32

Expert Comment

by:jhance
ID: 2711375
To detect if there is a logged on interactive user, enumerate the window stations until you find WinSta0.  Then use that handle to enumerate the desktops.  If you find WinSta0\default, then there is an interactive user logged in.  If this desktop doesn't exist, then there is no interactive user logged in.
0
 
LVL 3

Expert Comment

by:shaig
ID: 2711858
So, what will it be wierd dave?
0
 

Author Comment

by:wierd_dave
ID: 2716357
I went for the windows hooks. Placed in a dll they should be able to log all activity from what MSDN tells me.

This has been a thread full of good stuff as far as I'm concerned - cheers to all.

Dave
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
function returning CString in a regular win32 DLL 8 147
twoTwo  challenge 35 86
noX challenge 17 76
Annoying "thing" blocks my view 4 50
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now