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

Posted on 2013-02-04
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.  >> 

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

Major Incident Management Communications

Major incidents and IT service outages cost companies millions. Often the solution to minimizing damage is automated communication. Find out more in our Major Incident Management Communications infographic.

LVL 55

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 500 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 55

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 55

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

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

Log files are useful in diagnosing and repairing problems.  This is a list of common log files and their standard locations that I've compiled.   While this is not exhaustive, it is a pretty good list that I've found to be useful.  I may update it f…
Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
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). …

724 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