Updated on 8/26/2008 with corrected information!

Window’s simple shutdown command works well, but has some major drawbacks. The major one is that it will only schedule a reboot up to 10 minutes into the future (600 seconds). Linux’s shutdown command makes this easy, just issue the command ‘shutdown -r +60’ for example to reboot an hour in the future.

No such luck in Windows, you need to download a separate program to do this. It is a sysinternals program, you might remember sysinternals from such utilies like FileMon and ProcessMonitor.

The program we use for this is called PsTools and more specifically the file psshutdown.exe.

[Download PsTools here]

Place psshutdown.exe into a directory for future use, for this example we will use c:\tools\.

Easiest Method:

Type the following command into the command prompt:

c:\tools\psshutdown.exe -r -f -c -t 02:00 /accepteula

PSshutdown will respond with:

PsShutdown v2.52 - Shutdown, logoff and power manage local and remote systems
Copyright (C) 1999-2006 Mark Russinovich
Sysinternals - www.sysinternals.com

Local system is scheduled to reboot in 15:08:00.

If all goes will, Windows will reboot at 2:00am, or your specified time. This command will start a system service with the psstools scheduling program, PSSDNSVC.EXE.

Alternate Method:

Then open a command prompt and type the following command:

at 2:00am c:\tools\psshutdown.exe -r -f -c -t 10 /accepteula

This will result in:

Added a new job with ID = 1

You can verify this task has been added by looking at the Scheduled Tasks – the job name will be At1 if you haven’t scheduled any other tasks via the command line.

7 comments
  1. Actually, the shutdown command is built into virtually every version of Windows released in the last 8 years:

    XP (Pro/Tablet/Media Center Editions)
    Vista (All Editions)
    Server 2003 (All Editions)
    Server 2008 (All Editions)

    The only exception is XP Home Edition.

    Syntax example: shutdown -r -f -t 10

    In fact, your use of psshutdown with Scheduled Tasks is silly because one of the main reasons to use psshutdown instead of the built-in shutdown is that the -t option of psshutdown supports HH:MM (time in 24-hour format) in addition to NN (number of seconds). So your example could have been:

    psshutdown -r -f -c -t 02:00 /accepteula

    Which is better because it does not rely upon the Task Scheduler service being enabled and running. Instead, psshutdown temporarily installs its own service. Occasionally, anti-malware which has been set to paranoid settings may block this, but typically such settings would also block the addition of a Scheduled Task.

  2. Actually, the shutdown command is built into virtually every version of Windows released in the last 8 years:

    XP (Pro/Tablet/Media Center Editions)
    Vista (All Editions)
    Server 2003 (All Editions)
    Server 2008 (All Editions)

    The only exception is XP Home Edition.

    Syntax example: shutdown -r -f -t 10

    In fact, your use of psshutdown with Scheduled Tasks is silly because one of the main reasons to use psshutdown instead of the built-in shutdown is that the -t option of psshutdown supports HH:MM (time in 24-hour format) in addition to NN (number of seconds). So your example could have been:

    psshutdown -r -f -c -t 02:00 /accepteula

    Which is better because it does not rely upon the Task Scheduler service being enabled and running. Instead, psshutdown temporarily installs its own service. Occasionally, anti-malware which has been set to paranoid settings may block this, but typically such settings would also block the addition of a Scheduled Task.

  3. Ronny, Thanks for the info. I’ve updated the post with your information! I agree – it is better to run it outside of task manager as it just leaves more points of failure.

  4. Ronny, Thanks for the info. I’ve updated the post with your information! I agree – it is better to run it outside of task manager as it just leaves more points of failure.

  5. I’d just like to add the the “-accepteula” switch seems to be required. Otherwise the reboot just hangs there and eventually times out–if it’s a scheduled task.

Comments are closed.

You May Also Like

Installing And Compiling Zabbix Client / Agent

Zabbix is an excellent system monitoring package. It does everything from basic…

Attach files to email via command line

This is a pretty simple thing to do, once you’ve figured it…

Anti spam for forums and security

If you have ever run a blog, forum, or any other interactive…

Tweaking TCP for Fast (100mbps+) Connections and Transfers on Linux

We recently did some speed testing on a few of the servers on our network, and we were not receiving the speeds expected considering they were sitting on a physical 100mbps ethernet port. The servers were indeed on physical 100mbps connection, however wget (TCP/IP, HTTP Port 80) download tests showed only a max of about 1.5MB/sec (note the 8bit/byte conversion, so this translates to about 12mbits).