Link to home
Start Free TrialLog in
Avatar of mildogz
mildogz

asked on

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.
Avatar of Kash
Kash
Flag of United Kingdom of Great Britain and Northern Ireland image

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?
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.
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

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
ASKER CERTIFIED SOLUTION
Avatar of SStory
SStory
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
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.
Hmm.  What reason? Because they might kill the app from task manager?
If that is the problem, a service might do it also.
Avatar of mildogz
mildogz

ASKER

This solution worked great. Thanks sstory.
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.
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.