• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1148
  • Last Modified:

Determine whether a computer is locked out (versus actually being in-use)?

Hey experts -
Is there any way to figure out if a machine has been locked out (or possibly even when screen saver is in use)? I frequently remote to workstations and use PsTools such as PsExec to deploy stuff to the machines, but the fact that I have to do this during business hours makes it a bit harder for me. I currently use psloggedon to determine if a user is logged on a machine, but it doesn't tell whether the user is actually ON the machine and currently using it or whether the user has decided to lock his machine and go out to lunch.
My current method is to:
1) use psloggedon to determine if a user is logged on, and WHEN the user logged on
2) call or email the user to request them to log off so i can patch/troubleshoot their workstation

The problem with this method is my organization has not been proactive in updating the phone roster.. so a majority of users don't even have phone numbers listed in the GAL or they have OLD numbers listed in the GAL. When i attempt to email them, most of the time they are slow to respond or don't respond at all. In addition to this, we have a good number of users who NEVER log off their machine, but lock their machine.. so my current "logon/logoff script" which records the last username/time for each computer in AD is not as accurate as it could be.

So some entries might say the user was logged on since 3 weeks ago on a particular machine even though they haven't logged on since 2 weeks ago (when they left for vacation but never logged off their machine). So what I resort to is either booting them off and hope they don't complain. What would be nice is a way to figure out when the user has locked their workstation, so I can make an executive decision and assume they left for the day and kick them off so I can do my job.
Are there any commands (i.e. pstools or sysinternals tools) or even vbscripts or batch files that can grab the status of the machine (remotely) and report it back?

And yes, yes I know that I could make some policy changes to force users to log off their machines and automatically kick them off after a certain period of inactiviy.. but that's a question for another day. That would be something that'd take some time bc I'd have to move that up the chain, and I'd rather find a quick solution now to get my work done now.  >_<!

  • 3
2 Solutions
try to define a mapped screen saver file to a network driver, different for each computer.
you can list all mapped screen savers under the same folder (when they are sitting on subfolder)
and list them on "last accessed" state, or just try to list the subfolders the same way that might work.
you can also try:


and have they computers access a default site you defined that collects the machin's ip and creates a new file everyday.
it's a bypass but I don't know a better way:)

Danny ChildIT ManagerCommented:
This might be of interest...
but requires the users to be Admins?
ThinkPaperAuthor Commented:
i'm not interested in accessing the user's desktop, just the machine itself when the user has locked the machine. reason being - most of the machines i'm remoting into are machines I'm having trouble with one way or another.. but i wanted to find an easier way for me to determine whether its ok to boot a person off or not. (didn't want to boot them off if they happened to be.. say drafting up an important document to the CEO or something).
ThinkPaperAuthor Commented:
Roughly based off of Giladn's, I found a good simple solution that uses the screensaver to detect inactivity..


dim objWMIService, colItems

strComputer = "computername"

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") 
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Process",,48) 
ssActive = false

For Each objItem in colItems 

  if instr(1,objItem.Caption, ".scr") > 0 then
   ssActive = true 
  end if


if ssActive = true then
  wscript.echo "Screen saver is active on " & strComputer
  wscript.echo "Screen saver not active on " & strComputer
end if

Open in new window

ThinkPaperAuthor Commented:
- Using pslist looks like another good option you can use to determine which screensaver is active

pslist //computer "logon.scr"  (assuming you know the exact screensaver that should be running)

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now