I want to setup my computer to logoff users after 15 minutes of use.

Posted on 2013-02-04
Medium Priority
Last Modified: 2013-02-11
HI all,

I am looking for a way to log off users after 15 minutes of use. I am using windows 7 Home. I know there are programs that you can use like deepfreeze or clean slate, but these only have options if the computer is idle. What I need to do is setup the computer to log off even if the user is still using the computer. I want a 15 minute limit setup before it logs off.

I tried the shutdown command shutdown.exe /m \\computername /l /f /t 30 "This machine will Shut Down in 30 seconds"

but i know the L options does not work with the M option. So i tried it this way.

shutdown.exe /l \\vmw7-pc /f /t 30 "This machine will Shut Down in 30 seconds"

But it does not work, and I get a prompt for "reasons on this computer". Anyone out there know how to get this command to work right?

this question is worth 500 points. thanks.
Question by:mildogz
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 19

Expert Comment

ID: 38851517
you need a script which is like a scheduled task which automatically logs user off after 15 minutes.  >> http://www.vistax64.com/tutorials/132903-task-scheduler-create-task.html 

something similar to this will work.

the users >> are they limited profile users, you don't want them to be admins?
LVL 25

Expert Comment

ID: 38851523
Are you wanting it to shutdown or logoff?  
The /t specifies time to shutdown the computer. That doesn't sound like what you want.

do the /l (log off) and /f (force)

To run 15 minutes after login you will probably need a timer app.

Expert Comment

by:Robby Swartenbroekx
ID: 38851535
On the client computer: put the following in a start-up script:
shutdown.exe /l /t 900 /c "You are eligible for a 15-minute fixed session."

Open in new window

don't make the user administrator, otherwise they can cancel this by
shutdown -a

Open in new window

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

LVL 56

Expert Comment

ID: 38852715

First @LordPan: the person initiating the shutdown can always cancel it, no matter if admin or not. That's why we need an approach with a different account. Also, /t does not accept anything greater then 600 on OS' Vista/win7/win8 and modern servers.

To follow innocentdevil, you need to creat a task that runs as system (no password needed, simply type in system). That task needs to be triggered at logon and the option to delay the task for 15 minutes must be set. The action has to be
shutdown /f /l /t 0
LVL 25

Accepted Solution

SStory earned 2000 total points
ID: 38852953
The task seemed interesting to me so I wrote an app called RunAfter.
Be sure DotNet 2.0 is on the machine.

Copy the attached file somewhere, rename it to runafter.exe.
I had to name it .resx for this site to accept it.

To simple logoff a user after 15 minutes do this:

runafter M 15 /FL

To find out all params

runafter <with no args>

I have only tested minutes (actually 2 minutes) for the forced log off.
I have tested seconds as well. I have not tested MS or Hours. Be advised some ops take longer than a specified MS to complete. There is also the /I which says do a command repeatedly at the specified interval.

Command followed by args must be the last arguments. The first two args are required. They are H for hours, M for minutes, S for seconds or MS for milliseconds and the interval.

so M 5 is five minutes. You can use fractions on hours and minutes. So 1.5 hours would be converted to 90 minutes.

Feel free to use it freely, but of course not to sell it.

LVL 25

Expert Comment

ID: 38854880
Also, this command allows you to run any other command after a given time.

runafter.exe M 15 shutdown /r

Will restart the computer after 15 minutes

runafter.exe H 1 /I robocopy.exe d:\FOLDER1 c:\FOLDER2 /E /PURGE

This should sync folder1 and folder 2 every hour until this instance of runafter is terminated either by task manager or probably when the user logs out.
Again, I have not tested it out extensively.
LVL 56

Expert Comment

ID: 38855225
SStory, nice work, but: for reasons given before by me, you would need task scheduler anyway. And TS has that delay-function built-in already.
LVL 25

Expert Comment

ID: 38855913
Hmm.  What reason? Because they might kill the app from task manager?
If that is the problem, a service might do it also.

Author Closing Comment

ID: 38877944
This solution worked great. Thanks sstory.
LVL 56

Expert Comment

ID: 38878205
Although this is an approach, I would not use it for reasons given: the user can always stop the shutdown process as its his own process.
LVL 25

Expert Comment

ID: 38878528
It is true that a savvy user could kill it.  I suppose you could make a task that runs when they
Login and have it run as system or admin to avoid that,or you could write a windows service.  You could also use group policies to disable the CTRL ALT DELETE and prevent them from killing it.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface Having the need * to contact many different companies with different infrastructures * do remote maintenance in their network required us to implement a more flexible routing solution. As RAS, PPTP, L2TP and VPN Client connections are no…
The way I use Experts Exchange to assist me in analyzing and diagnosing a problem is I first enter a Verbose Question at Experts Exchange like: Office 2007 will hang when opening and saving files I then launch WordPad (any text editor will do) an…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

777 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