Welcome Guest.   Make a donation to an author on the site October 25, 2014, 03:51:55 AM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
The N.A.N.Y. Challenge 2012! Download dozens of custom programs!
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: log users off at a certain time using task scheduler  (Read 4102 times)
techidave
Supporting Member
**
Posts: 963


see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« on: January 27, 2008, 01:50:05 PM »

I have been trying to use the shutdown in a batch file to log a user off at a certain time but am having difficulties getting the switches right.  I am using shutdown -c-l 300 -m "Time restrictions are now forcing you to logoff in 5 minutes; please save all your work."  But the problem with this is it defaults to 60 seconds instead of 5 minutes.  It also grays out the option to cancel which is what I want.  If I reverse the c and l switch then it will do the 5 minutes but the cancel button is now active.  All I want it to do is log them off but this will shut the computer down instead. 

The l switch is suppose to log off only and if I remove the m switch then i cannot get the 5 minutes and it shutsdown.

Any ideas on how to fix this?  Maybe this could be a coding snack?
Logged
jgpaiva
Global Moderator
*****
Posts: 4,710



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #1 on: January 27, 2008, 02:14:20 PM »

Now i'm confused... What OS do you have?

My win xp pro sp2 doesn't have the -m switch, and the -c switch is for adding a comment to the shutdown dialog...
Logged

techidave
Supporting Member
**
Posts: 963


see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #2 on: January 27, 2008, 02:26:32 PM »

I have XP SP2.  I downloaded the shutdown utility from Beyond Logic Shutdown http://www.beyondlogic.or...ons/shutdown/shutdown.htm
Logged
jgpaiva
Global Moderator
*****
Posts: 4,710



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #3 on: January 27, 2008, 04:20:08 PM »

Ok, now i understand.
It's a shame that the default "shutdown" utility that comes with windows doesn't allow you to logoff and have a timeout.

There are a few shutdown utilities that i'm sure are able to do this...

What exactly would you like to do? have the system display a message indicating that the computer will log of in X minutes, right?
Logged

techidave
Supporting Member
**
Posts: 963


see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #4 on: January 27, 2008, 05:02:47 PM »

that is correct.  I have set up restrictions using the net user routine but it won't log them off if they are already logged in.  So lets say I have "son" set to end at 9pm and would like for the logoff utiltiy to run at say 9:05pm and then in 5 minutes it would log him off at 9:10pm.

is this doable?
Logged
jgpaiva
Global Moderator
*****
Posts: 4,710



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #5 on: January 27, 2008, 06:23:41 PM »

It sure is doable, so much so that it's done! smiley

So, it only has 2 arguments (which are mandatory): timeout (in seconds) and message.

Example:
logoffin.exe 120 "the computer will logoff in 2 minutes"

There's a minor quirk: it won't log off until the messagebox is closed. As a workaround, i added a timeout of 30 seconds to the messagebox, thus, the minimum time that it guarantees the computer will be logged off is 30 seconds.

* LogoffIn.ahk (0.57 KB - downloaded 168 times.)
* LogoffIn.exe (198.88 KB - downloaded 185 times.)
Logged

nite_monkey
Member
**
Posts: 692


see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #6 on: January 27, 2008, 06:33:58 PM »

using the program you mentioned(the beyond logic shutdown) try using shutdown -s logoff -l 300 -c -m "Time restrictions are now forcing you to logoff in 5 minutes; please save all your work."
Logged

[Insert really cool signature here]
techidave
Supporting Member
**
Posts: 963


see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #7 on: January 27, 2008, 07:05:14 PM »

thanks for the suggestions!  I will try them both and see how I like them.  Since the kids are now on that computer, I will have to wait to try it out.
Logged
lanux128
Global Moderator
*****
Posts: 6,109



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #8 on: January 27, 2008, 11:21:51 PM »

if you want more choices, take a look here. there are several tools mentioned.

CyberNotes: Remotely Restart & Shutdown Computers

Logged

MikeMcLoughlin
Supporting Member
**
Posts: 31

View Profile Give some DonationCredits to this forum member
« Reply #9 on: January 28, 2008, 04:22:14 AM »

I've found Shutter to be excellent.

http://www.den4b.com/
Logged
patthecat
Member
**
Posts: 88


View Profile Give some DonationCredits to this forum member
« Reply #10 on: January 29, 2008, 07:03:27 PM »

I have used both
Shutter (http://www.den4b.com) and
PowerOff (http://users.pandora.be/jbosman/applications.html)
Both utilities have the capability to LogOff a user as what you are looking for.

Currently at my niece&nephew's computer, I have task scheduler invoke a batch file calling PowerOff to shutdown the computer after 45 minutes of inactivity.  There's a 30 second message pop-up window warning of the shutdown.  The PowerOff specific command in the batch file I am using is:

start /min poweroff.exe shutdown -force -warn -warntime 30

You can add the "-nocancel" option to prevent the cancellation of the action from the warning message box or sys tray.

Patrick
Logged
Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.033s | Server load: 0.08 ]