• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 674
  • Last Modified:

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

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
mildogz
Asked:
mildogz
1 Solution
 
Kash2nd Line EngineerCommented:
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
 
SStoryCommented:
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
 
Robby SwartenbroekxMSP engineerCommented:
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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
McKnifeCommented:
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
 
SStoryCommented:
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
 
SStoryCommented:
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
 
McKnifeCommented:
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
 
SStoryCommented:
Hmm.  What reason? Because they might kill the app from task manager?
If that is the problem, a service might do it also.
0
 
mildogzAuthor Commented:
This solution worked great. Thanks sstory.
0
 
McKnifeCommented:
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
 
SStoryCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now