?
Solved

Force windows logoff after certain amount of LOGON time

Posted on 2004-09-18
7
Medium Priority
?
467 Views
Last Modified: 2013-12-04
I know there are many ways to force user logoff based on idle timeouts, but I need to be able to force a locally logged in user to logoff after say a 2 hour period.  That is to say that the user cannot be logged in for more than 2 hours whether they are doing stuff or not.  
Any help would be much appreciated.
Thanks,
Nate
0
Comment
Question by:nateb
[X]
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
  • 2
  • 2
7 Comments
 
LVL 11

Expert Comment

by:Quetzal
ID: 12092349
Use the winexit.scr screen save available in Windows NT, 2000, 2003 resource kits.  It does just what you want.

http://www.win2000mag.com/Articles/Index.cfm?ArticleID=4541
0
 

Author Comment

by:nateb
ID: 12115038
actually, maybe i didn't state the question as clear as i could have.  I know about winexit, and other similar programs.  But what I need to be able to do is force logoff based on actual logon time, not on idle time. so, after the user has been logged in for 2 hours, they are automatically logged off.  WHETHER or not they are idle.  i have thought about using onlogon events in the task scheduler and calling an external script to handle this, but there has to be a better way than reinventing the wheel, plus i'm not quite sure how I would terminate the script at user logoff time.....
thanks,
Nate
0
 
LVL 11

Assisted Solution

by:Quetzal
Quetzal earned 150 total points
ID: 12158981
Ur on the right track.  Use PsShutdown (http://www.sysinternals.com/ntw2k/freeware/psshutdown.shtml) to schedule the shutdown in the user logon script.  You'll need to calc the shutdown time based on logon time.

Shutdown.exe is available in XP and the NT/2K resource kits, but it lets users abort the shutdown.
0
 
LVL 12

Accepted Solution

by:
alandc earned 350 total points
ID: 12231331
You can do it but I'm not sure how helpful it will be --

Get PSSHUTDOWN.EXE from SYS Internals:
http://www.sysinternals.com/ntw2k/freeware/psshutdown.shtml
and install PSSHUTDOWN somewhere in your PATH

Add this line to your logon batch to run shutdown in 7200 seconds (2 hours) with
PSSHUTDOWN -r -t 7200

Of course anyone could just cancel it by running
PSSHUTDOWN -a

And meanwhile the window would be displayed saying
"The system is shutting down ..."

Here is a more complicated plan:
Get CHOICE.EXE from the NT Resource Kit:
http://www.ss64.com/nt/choice.html

Get PSSHUTDOWN.EXE from SYS Internals:
http://www.sysinternals.com/ntw2k/freeware/psshutdown.shtml

create the following batch file and name it WAIT.BAT:
@CHOICE /T:N,%1% > NUL

Create the following batch file and call it SHUT2H.BAT:
CALL WAIT 7200
PSSHUTDOWN -r

Place all the above somewhere in your PATH (such as C:\WINNT)
Then call SHUT2H.BAT as the last command in your logon script

Of course the user could just cancel it by hitting Ctrl-BREAK in the script window.

It is possible but it isn't secure.

You could also use FireDaemon
http://www.firedaemon.com/
to cause it to run as a service and that might help with your security needs.

t
0
 

Author Comment

by:nateb
ID: 14029033
I appreciate the input on this issue, but I wasn't able to implement as secure and reliable of a solution as I was hoping for.  I ended up getting sidetracked on other projects and still have not gotten back to this issue, but since the question is will be closed shortly, I wanted to go ahead and apply the points before that was done.  Hopefully I will be able to get back to this project sometime in the near future.
Thank you both for your suggestions.

Nate
0

Featured Post

Independent Software Vendors: 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

As I write this article, I am finishing cleanup from the Qakbot virus variant found in the wild on April 18, 2011.  It was a messy beast that had varying levels of infection, speculated as being dependent on how long it resided on the infected syste…
OfficeMate Freezes on login or does not load after login credentials are input.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month8 days, 10 hours left to enroll

764 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