Batch file to automatically log a user off after a time of inactivity

Page 1 of 2 12 LastLast

  1. Posts : 605
    W7 Ultimate
       #1

    Batch file to automatically log a user off after a time of inactivity


    Those of you who have read my posts over the past couple of weeks know what am doing on a computer belonging to an Assisted Living facility.
    I have the user accounts set up plus I have removed the "Switch User and Sleep menu items from the context menu of "START.......SHUTDOWN. I have reminded the users to log off several times. I have used BRINKS tutorial to create a LOG OFF shortcut and pinned the shortcut to the task bar. Some of the users STILL fail to logoff when they are done using the computer. I am now wanting to log them out of their account after an adjustable period of inactivity Maybe you wizards can come up with a tutorial to accomplish this.
    What I am thinking is a screensaver type of auto log-off. The screensaver would come on after a predetermined period of inactivity. It would have a warning msg and display a countdown. At the end of the countdown the log-off command would be initiated.
    External (administrator) inputs
    1. Length of inactivity.
    2. Length of warning, time it is displayed.
    3. Maybe text of the warning.
      My Computer

  2.    #2

    Hi Blockie -

    Since Sleep or Hibernate would save the same user session and not Log Off it's probably not what you want even though the PC would be suspended until awakened or resumed.

    Doing a search I found two methods that might work for you that also provide templates for either Task Scheduler in any version, or Group Policy controls if you have Pro or Ultimate.

    automatic logout after inactivity/idle using Task Scheduler

    WizardSoft - AutoLogoff cleanup & end inactive Windows sessions using Group Policy.
      My Computer


  3. Posts : 605
    W7 Ultimate
    Thread Starter
       #3

    Thanks Greg,
    I forgot to mention that the computer in question is running W7 Premier 64bit. That makes it not able to take advantage of Group Policy, I believe. It also saves from paying $260 for the program.
    The first suggestion about using the Task Scheduler was interesting although the thread turned into a pi..ing contest and I was not able to separate the wheat from the chaff, so to speak.
    Bill
    Last edited by blockie; 16 May 2013 at 09:55. Reason: spelling
      My Computer


  4. Posts : 17,545
    Windows 10 Pro x64 EN-GB
       #4

    The Task Scheduler alternative works, using Idle Timers, with one small issue: system checks the idle timer only once every 15 minutes. Whatever conditions you use, it is never exact.

    For instance I use these settings but sometimes it takes almost half an hour idle time before system logs me out:

    Batch file to automatically log a user off after a time of inactivity-2013-05-14_151225.png
      My Computer


  5. Posts : 605
    W7 Ultimate
    Thread Starter
       #5

    OK. Now, before I start. Is the TS choice universal? That is does it work for all the users accounts? Usually a second user does not start right away. If a second user logged into his/her account and began to do work, would he/she be logged out also? That would open another bag of worms.
    Bill
      My Computer


  6. Posts : 17,545
    Windows 10 Pro x64 EN-GB
       #6

    You need to use two triggers, On Idle and At log on.

    Set first On Idle trigger:
    Batch file to automatically log a user off after a time of inactivity-2013-05-14_150011.png
    Do the same procedure for At log on trigger:
    Batch file to automatically log a user off after a time of inactivity-2013-05-14_150213.png
    It results this:
    Batch file to automatically log a user off after a time of inactivity-2013-05-14_150258.png

    Kari
      My Computer


  7. Posts : 605
    W7 Ultimate
    Thread Starter
       #7

    Did it and it worked, at least once. Will leave it enabled to be sure. Now for the ACTION. I would like to call a screensaver, have it run for 30 seconds displaying a warning and let it start the log off as it closes. Spent most of the afternoon looking for such a screensaver or a program to create a SS with the necessary options. Couldn't find one. Maybe one of you wizards can suggest something. Hoping !
    Bill
      My Computer


  8. Posts : 17,545
    Windows 10 Pro x64 EN-GB
       #8

    That could be tricky. The program would be launched when the system is already starting the log off process.
      My Computer


  9. Posts : 605
    W7 Ultimate
    Thread Starter
       #9

    Kari,
    I think you misunderstand what I am thinking. I would like the ACTION tab of the task to operate in this fashion.
    1. Start a screensaver
    a. This SS would only be about 30 second long
    b. It would display a warning that the system is about to log off, with a timer to countdown to zero, if possible.
    2. At time zero, see 1b above, or if countdown timer is not available, initiate the program to log off after the SS closes, see 1a above.
      My Computer


  10. Posts : 17,545
    Windows 10 Pro x64 EN-GB
       #10

    No, I understood you. It's just that I have been testing an playing this idle timer so much I doubt it works as you planned. Tasks with idle timer are IMO the most difficult to get working as you'd like to.
      My Computer


 
Page 1 of 2 12 LastLast

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 15:53.
Find Us