Page 2 of 2

Re:Scheduling Windows XP Shut Down

Posted: Thu Apr 28, 2005 5:09 am
by durand
Windows XP has an at daemon and a shutdown command. You can schedule events at any interval you want and to repeat on certain days, if required - even on remote machines.

From the command line:

> at 06:00 /EVERY:m,t,w,th,f,s,su shutdown -f -s

Shutdowns the computer every day at 6am.

> at 06:00 shutdown -f -s

Shutdowns the computer at 6am and the task is never rescheduled.


http://www.ss64.com/nt/

Re:Scheduling Windows XP Shut Down

Posted: Thu Apr 28, 2005 5:30 am
by AR
I didn't know it could do that, but I tested it and all it does is create a scheduled task like I originally suggested, it's a neat trick though.

Re:Scheduling Windows XP Shut Down

Posted: Thu Apr 28, 2005 5:46 am
by durand
Yeah. It's cool. I once wrote this fancy program to acquire Tokens and do shutdown itself... and then Service Pack 2 came along and it no longer worked.

Then I discovered at.. and all my work was made redundant. :)

Re:Scheduling Windows XP Shut Down

Posted: Sun May 01, 2005 11:37 am
by rich_m
but you can shut down the computer with this command:
rundll32 user,exitwindows
i scheduled a batch file with that command and it works fine in 98.

but the shutdown.exe in XP does'nt work as sceduled

Code: Select all

at 06:00 /EVERY:m,t,w,th,f,s,su  shutdown -s
does create a schedule, but my pc did'nt shut down @ 6.
any idea as to wat could be the problem? ???

Re:Scheduling Windows XP Shut Down

Posted: Sun May 01, 2005 4:29 pm
by AR
Since it doesn't have an AM/PM, I assume that it is a 24 hour clock so it should have shutdown at 6AM.

If it didn't then the scheduling service may be disabled but that's unlikely.

Re:Scheduling Windows XP Shut Down

Posted: Sun May 01, 2005 4:50 pm
by durand
Does it shutdown if you do it 5 minutes in the future and wait for it? Don't forget the -f flag in the shutdown command which forces all apps to quit. Do you have the privileges to do it? Is your clock right?

What does the Event Viewer say? (Start -> Run -> eventvwr)

What if you go to a command line and just type: shutdown -f -s ?

Does it work then? If not, what is the error it returns?

..etc..

Re:Scheduling Windows XP Shut Down

Posted: Mon May 02, 2005 11:14 am
by rich_m
well still does'nt work, I think its a problem with the scheduler.. cause it works fine when done manually. i also tried creating a batch file with the following code:

Code: Select all

@echo off
start C:\windows\system32\shutdown -f -s
when i run the batch file a window appears with a 30sec countdown before shuting down.

i scheduled this batch file, and even though my pc time is perfect and I have the adminstrator rights it wont execute as scheduled.

Re:Scheduling Windows XP Shut Down

Posted: Mon May 02, 2005 1:51 pm
by Eero Ränik
Run "services.msc" to see if you have "Task Scheduler" service disabled.

Re:Scheduling Windows XP Shut Down

Posted: Tue May 03, 2005 10:47 am
by rich_m
nope it is'nt disabled :-\

Re:Scheduling Windows XP Shut Down

Posted: Tue May 03, 2005 5:12 pm
by durand
Checking the Scheduled Tasks Log
Scheduled tasks maintains a log file (Schedlgu.txt), in the c:\Windows folder. You can view the log from the Scheduled Tasks window by clicking View Log on the Advanced menu.

The log file size is 32 kilobytes (KB), and when the file reaches its maximum size, it automatically starts to record new information at the beginning of the log file and writes over the old log file information.


Checking the Task Scheduler Service
The Task Scheduler service must be running and properly configured to run tasks. If you had stopped scheduled tasks manually from the Scheduled Tasks window, the service stops and does not initialize the next time you start the computer. If the service is not configured to log on as the local system account, it may not start.

To check the settings for the service:
1.   Click Start, click Control Panel, and then double-click Administrative Tools.
2.   Click Computer Management.
3.   Expand Services and Applications, and then click Services.
4.   Right-click the Task Scheduler service, and then click Properties.
5.   On the General tab, make sure that the startup type is set to automatic, and that the service status is Started. If the service is not running, click Start.
6.   On the Log On tab, make sure that the local system account is selected, and that the Allow service to interact with desktop check box has a check mark.
7.   Click OK, and then quit Computer Management.

Re:Scheduling Windows XP Shut Down

Posted: Tue May 03, 2005 5:16 pm
by AR
Have you tried:

Code: Select all

at 18:00 "shutdown -f -s"
Which means 6:00 PM in 24 hour clock. The command's help isn't particularly useful but it may accept AM/PM. It also says to wrap the command in quotes.