I have a Windows XP netbook and it is protected with a password. I want to be able to control the time other people spend on the computer, so whenever anyone logs in I want the computer to automatically log off after two hours.


How about executing logon script (help: To assign user logon scripts) with following code:

ping -n 7200 -w 1000
shutdown /l /f

This script will wait 7200 seconds (2 hours) and then force to log off.

  • I think this is the most useful thing to do because XP task schedules can't have a delay before they run so a "helper program" or script will have to do. This answer will cause a command prompt window to be on screen for 2hrs that can be closed by the user - thus circumventing the logoff script's process - but due to XP's lack of features there's nothing much more you can do... Windows 7, howevere, DOES have the ability to delay the task start.
    – Kinnectus
    Mar 11 '15 at 8:57
  • In Windows Vista, there are lock / unlock events, which can be used to run the script without command prompt window: In Windows 7, How to query times, when the computer was locked?. I don't have Windows XP, to check if there are similar events available.
    – Virus_7
    Mar 11 '15 at 8:59
  • That, again, is a little more advanced for XP (I think?!)... and even then, it would be no different to the script you've written... a "logon" event would still need to have a script run for 2hrs... a "logoff" event would be useless because the user will be logged off lol...
    – Kinnectus
    Mar 11 '15 at 9:01
  • You can create Start a program action, while creating task in Task Scheduler (Win + R > taskschd.msc)
    – Virus_7
    Mar 11 '15 at 9:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.