Solved

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

Posted on 2013-02-04
11
652 Views
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.
0
Comment
Question by:mildogz
11 Comments
 
LVL 19

Expert Comment

by:Kash
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?
0
 
LVL 25

Expert Comment

by:SStory
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.
0
 
LVL 7

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

0
 
LVL 53

Expert Comment

by:McKnife
ID: 38852715
Hi.

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
0
 
LVL 25

Accepted Solution

by:
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.

IT IS PROVIDED AS IS WITH NO WARRANTY GIVEN OR IMPLIED.  THERE IS NOTHING INTENTIONALLY DESTRUCTIVE IN THE PROGRAM. USE AT YOUR OWN RISK.
runafter.resx
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 25

Expert Comment

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

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.
0
 
LVL 53

Expert Comment

by:McKnife
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.
0
 
LVL 25

Expert Comment

by:SStory
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.
0
 
LVL 1

Author Closing Comment

by:mildogz
ID: 38877944
This solution worked great. Thanks sstory.
0
 
LVL 53

Expert Comment

by:McKnife
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.
0
 
LVL 25

Expert Comment

by:SStory
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.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
This is a little timesaver I have been using for setting up Microsoft Small Business Server (SBS) in the simplest possible way. It may not be appropriate for every customer. However, when you get a situation where the person who owns the server is i…
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). …
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

759 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now