Setting your PC to shut down automatically at a set time of day

I’ve been asked before how to set up a PC to automatically shut itself down at a particular time. In circumstances where there are a large number of PCs, this becomes one of the only options that are workable if you have a number of users who refuse to shut down their PCs.

In Windows XP, this is an easy task to manage.

In days gone by, you could use the command AT to set up scheduled tasks to run. This was OK and did the job adequately but it didn’t give you complete control of the task that would be created. For example, by using AT, you would create the task name AT1. That’s what it would be called; don’t like it? Tough!

Now, in Windows XP the command SCHTASKS has joined the party. In order to show you how to use it, let’s answer the original question.

Q- How do I set my PC to shut down every day at the same time?
A- Run the following command at the command line (Start – Run “cmd”):

SCHTASKS /Create /TN “Shutdown PC at Night” /TR “C:\Windows\System32\Shutdown.exe /s /f” /RU domain\username /RP password /SC DAILY /ST 21:30:00

OK, scary isn’t it? Let’s break it down:
SCHTASKS /Create (Create a task)
/TN “Task name” (Call the task by this name)
/TR “command line” (Run this command)
/RU domain/username (Run as this user)*
/RP password (with this password)
/SC DAILY (Schedule to run daily)
/ST 21:30:00 (Run at 21:30)

* the /RU command can also be used thus: /RU computername/username

In order to get a better idea of the kind of power this command can have, simply run SCHTASKS /CREATE /? at the command line. It’ll tell you what you want to know.

This was a very brief description of one of the many functions available through SCHTASKS.exe and Shutdown.exe, I’ll get into some others on further posts regarding these brilliant (and free) utilities.