Solved

Force windows logoff after certain amount of LOGON time

Posted on 2004-09-18
7
444 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
  • 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 75 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 175 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Recently, a new law in my state forced us to get a top-to-bottom analysis of all of our contract client's networks. While we have documentation, it was spotty at best for some - and in any event it needed to be checked against reality. That was m…
In today's information driven age, entrepreneurs have so many great tools and options at their disposal to help turn good ideas into a thriving business. With cloud-based online services, such as Amazon's Web Services (AWS) or Microsoft's Azure, bus…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

757 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

16 Experts available now in Live!

Get 1:1 Help Now