We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

Looking for "after idle for x minutes, logoff" solution

piattnd
piattnd asked
on
Medium Priority
637 Views
Last Modified: 2012-05-06
Experts!

I need to review the possibilities of scripting a solution to log off a user after "X" idle time.  I've researched some possibilities, however I haven't come up with anything yet.

From the sounds of it, WMI does not have a method to check the idle time on a windows session.

One of the things I was thinking about trying is to read the position of the mouse and storing the position in a variable.  If the position is the same, then the computer is idle; however, the only way I can think of to check the mouse position is to set an app as focus and check the mouse positioning there.

Does anyone have any possible solutions for this?  I'd prefer to stick to scripting methods and stay away from third party software, but any suggestions are welcome.
Comment
Watch Question

tigermattSite Reliability Engineer
CERTIFIED EXPERT
Most Valuable Expert 2011

Commented:

I'd use the WinExit screensaver which you can find information on at http://windowsxp.mvps.org/winexit.htm.

Assuming we're talking about an Active Directory network, once the screensaver tool is installed on each computer on your network, you'd be able to force all PCs to use it through Group Policy - so users cannot change the setting.

-Matt

Author

Commented:
I saw this in another post, but there are a few other items we have to try and close "properly" to prevent any issues, which is why I'm hoping for a scriptable solution, so I can close any programs needed or send any commands to the machine before logging the user off.  I've kept this one in mind thouhg.

Anything else?
Site Reliability Engineer
CERTIFIED EXPERT
Most Valuable Expert 2011
Commented:

Could you use a Scheduled Task which runs a script? There is the option in the Advanced Settings of the schedule on a Scheduled Task to have it run only when the computer is idle for a set period of time. You could easily create a task which runs on idle for X minutes, with the task launching your script to close down the appropriate applications and then log the user off.

The command for logging a user off (in a Windows Shell) would be shutdown.exe -l - and you'd obviously do this last, after you'd run commands to shut other programs.

A less desirable approach - but one that will definitely work.

-Matt

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
Hmm, I'll have to give that one a shot,  but as you said, not exactly desireable.  I'll check out that possibility as well.

Commented:
If you want to run a script to close all application safely, the best way to know when the workstation is idle for X minutes, is still to make you script as a screensaver.
Commented:
If you can't make a screensaver that do the job, you can also set a defined screensaver (like logon.scr) and look when it's running using vbs :

http://www.microsoft.com/technet/scriptcenter/resources/qanda/aug05/hey0810.mspx

when's it's running, it's time to start your script.

Author

Commented:
That's a good thought too.  I'll take a look at both of these items on Monday.

Author

Commented:
Thank you both for your help.  This project has slipped to the back burner for now, but I'm closing this question.  Thanks for the answers!
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.