How to Reboot Server 2008 R2 with Task Scheduler

scheduled-taskwindows-server-2008

I've been trying to get Server 2008 R2 to reboot after everyone is gone from work, to get its updates installed, but what I've been trying apparently isn't working.

I have a "reboot.bat" in C:/ that contains:

shutdown –r –f –t 5

The task is scheduled for 11:00PM, but when I come in the next day, it says "Last Run Result: (0x1)." and the server hasn't restarted.

Is there a better way to do this? Hopefully one that works…?

Best Answer

yes, set your scheduled task to run whether user is logged on or not and is set to run with highest privledges. For the Actions section, set the action to "start a program" with C:\Windows\System32\shutdown.exe and then /r /f /t 5 as the arguments.

Make sure the account credentials used for the task have Log on as Batch Job rights.