How to Shut Down Your PC Automatically

Combine a shortcut to Shutdown.exe with the Windows Task Scheduler, and you'll never have to worry about forgetting to shut down your work PC at the end of the day.

It's very simple to make a convenient shortcut to shut down your PC, rather than having to press Start | Shut down, and depending on your version of Windows, Shut down again. But consider this: If you combine such a shortcut with the Windows Task Scheduler, you'll never have to worry about forgetting to shut down your work PC at the end of the day. This should be especially welcome news to IT staff managing an office full of PCs that may be wasting big bucks, not to mention the equivalent of millions of tons of carbon dioxide by sitting at the ready all night while the office is closed.

I'll walk you through Windows XP's Task Scheduler first. To get started, open Scheduled Tasks from the Control Panel, then double-click on Add Scheduled Task. Using the Scheduled Task Wizard, pass over the list of applications, click on the Browse button, and navigate to Windows\system32\shutdown.exe. Name the task and choose the Daily option. Choose a time of day you want the system to shut down (don't worry if you occasionally have to stay late; you'll set a warning and a fail-safe before we're done). The wizard will then ask for your username and password; you can fill this in or skip it—it's just there to ensure the process can run even if no user is logged on.

Before pressing Finish to save the task, check the box marked Open advanced properties for this task when I click Finish. There's a tricky bit of business about Shutdown.exe—it will work only if you give it parameters. If you double-click on the program itself, nothing will happen. So, in the advanced properties dialog, in the Run box, append a space plus at least one item below from Menu A and any or no items from Menu B to the end of the shortcut.

Menu A
-s shut down
-l log off
-r reboot
Menu B
-t xx delay shutdown for xx seconds (Windows will display a warning box)
-c "Your text" add "Your text" to the warning box

Before clicking OK to close the box, mouse over to the Settings tab and check the box Only start the task if the computer has been idle for at least:, and set a comfortable amount of time. Don't bother with the box about stopping the task if the computer ceases to be idle; it won't work in this case.

To set up a scheduled shutdown in Windows Vista, the process is very much the same. Instead of starting in the Control Panel, simply invoke the Task Scheduler from the Start menu (taskschd.msc). Then, in the right-hand pane, click Create Task…. In the resulting dialog, name the task in the General tab. In the Triggers tab, create a New trigger. Choose On a schedule, and determine the schedule; confirm the Enabled box at the bottom is checked. From the Actions tab, choose Start a program, point to C:\Windows\system32\Shutdown.exe, and add switches as you would for Windows XP (-s to start, and any others you want). Finally, in the Conditions tab, check the box marked Start the task only if the computer is idle for:, and choose a comfortable amount of time.

Note: Whether you're using XP or Vista, once the shutdown sequence is activated, there's only one way to stop it: You will need to launch Shutdown.exe with the switch -a (for abort). So as a failsafe, create a desktop or Quick Launch icon called something like "Cancel shutdown" with the target C:\Windows\system32\shutdown.exe -a.

Advanced Tip: Use Shutdown.exe over the Network
Finally, for network administrators, you can make a neat batch file to set up shutdowns for all the PCs you have access to. We're assuming you don't have Active Directory; if you do, you can use the graphical interface to accomplish the same. You'll need either the IP address or the computer name of each machine. (I wouldn't recommend using IP addresses if you're using DHCP instead of static IP addresses; with dynamic addresses you'll have to chase down the PCs on the network.) A firewall will foil the process, so uncheck "Enable NetBIOS" in the firewall's config screens or open TCP port 139 to allow yourself access.

You need two lines in the Command Prompt to shut down a remote machine. The first gains access to the PC:

net use \\ip address or name of remote machine /user:username password

If the username contains spaces, it needs quotation marks, for example /user:"Neil J. Rubenking". The second line is

shutdown -m\\ipaddress –s

Note: You can add other switches, as above. For a full list, type shutdown /?. You might want to add a comment along the lines of "Warning: System shutdown in 2 minutes. Save all open work now."

To shut down a group of PCs, create a batch file. You'll need a net use and then a shutdown line for each PC. Now you can use Task Scheduler to shut down the group at the same time every day.

blog comments powered by Disqus