Scheduling Windows XP Shut Down

All off topic discussions go here. Everything from the funny thing your cat did to your favorite tv shows. Non-programming computer questions are ok too.
durand
Member
Member
Posts: 193
Joined: Wed Dec 21, 2005 12:00 am
Location: South Africa
Contact:

Re:Scheduling Windows XP Shut Down

Post 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/
AR

Re:Scheduling Windows XP Shut Down

Post 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.
durand
Member
Member
Posts: 193
Joined: Wed Dec 21, 2005 12:00 am
Location: South Africa
Contact:

Re:Scheduling Windows XP Shut Down

Post 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. :)
rich_m

Re:Scheduling Windows XP Shut Down

Post 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? ???
AR

Re:Scheduling Windows XP Shut Down

Post 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.
durand
Member
Member
Posts: 193
Joined: Wed Dec 21, 2005 12:00 am
Location: South Africa
Contact:

Re:Scheduling Windows XP Shut Down

Post 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..
rich_m

Re:Scheduling Windows XP Shut Down

Post 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.
Eero Ränik

Re:Scheduling Windows XP Shut Down

Post by Eero Ränik »

Run "services.msc" to see if you have "Task Scheduler" service disabled.
rich_m

Re:Scheduling Windows XP Shut Down

Post by rich_m »

nope it is'nt disabled :-\
durand
Member
Member
Posts: 193
Joined: Wed Dec 21, 2005 12:00 am
Location: South Africa
Contact:

Re:Scheduling Windows XP Shut Down

Post 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.
AR

Re:Scheduling Windows XP Shut Down

Post 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.
Post Reply