This is a very easy task and most of the system admin knows about it. But, it could be a good guide for the beginner. So today I would like to describe a quick way to schedule restart for Windows Server 2008 R2 (It implies in Server 2012/2008/2003 also).
A quick 4 steps will allow you to schedule or plan for starting server on your environment.
1. Open Task Scheduler from Administrative tools. Once you open it you can create a new task:
2. You can name the task for your easiness. But in security options, change the user account to Built in\Users (optional).
3. In next tab “Triggers” , create a new trigger and schedule on your demand as shown in picture :
4. In tab “Actions” , just provide a action as “Start a program” and then browse it to the shutdown.exe as shown in picture. ” /r ” helps you to restart.
That’s all. Simple, reliable and easy.
Cheers,
Udhyan.
Does this show as an unplanned reboot and give that nasty popup for users logging into the server (I’m thinking terminal server environment)?
No, it doesn’t show as an unplanned reboot.
Cheers,
Udhyan.
Hello, thanks for sharing, I have found it very interesting. Do you know if I can put a constraint not to run this task if another one is still running, in another words I want to control not to automatic restart the server if another task is still running.
Thanks!
Have you considered having the other task disable and then re-enable the restart task?
Don,
In the photos above, you can see a tab called CONDITIONS. Under that tab, you can specify to “Start the task only if the computer is idle” and include a time frame like idle for 30 minutes. You can also specify to wait for a couple hours for the computer to become idle and if it doesn’t it will abort the task until the next scheduled occurrence. Great question….
Amazing thx.
As shown above, the final step is incorrect. The PROGRAM line should end with shutdown.exe and the /r belongs in the [Add Arguments] box….
You can put shutdown.exe /r also or you can place /r in argument . Both option will work.
Great post!
Two ideas:
With shutdown command, it’s important to use: -f parameter, it forces running applications to close.
And you can also setup the scheduled task with schtasks command.
Extracted from:
http://www.sysadmit.com/2016/09/windows-programar-apagado-o-reinicio-automatico.html
You can use /f but your link is a little misinforming. He uses both /f and /t. /t implies a force close and if you want it to be immediate use /t 0 or /f but not both. It becomes redundant.
Agreed with Phil over here.
Never saw anything about “/t” and “/f” being mutually exclusive & redundant except that the help (at least on Windows 7) shows “IF t is > 0, THEN /f is implied.” To me, that says that you should do: shutdown /t 0 /f /r.
Other than that, I’ve never seen anything say /t /f are mutually exclusive. If so, please point me to it. But I think you may be saying “t 0” = “immediate shutdown,” so “/f” would not be needed in that case – if so, I can buy that.