How to Schedule a reboot of Windows Server
If you are looking for the good old AT command on Windows 8, Windows Server 2012 or newer OS, you will notice that the command has been deprecated. Instead you should check out the schtasks.exe command line tool, that also is a pretty powerful tool.
The need for scheduling a reboot of a server
There can be many reasons why you will need to schedule a restart of a server instead of just rebooting it right away. Most of the time it is because it is being used and you have to wait for a maintenance windows to perform the task. Often I have needed to schedule a server reboot or a Windows Service restart and I have been using the good old AT command for this task in many years. However, in newer OS starting with Windows 8/Windows Server 2012 the AT command is not working anymore. The new command to do those kind of tasks now, is the schtasks.exe command line tool. If you try to run the AT command on a newer operating systems, you will get the message below:
How to schedule a server restart with schtasks.exe
Ok, let’s have a look on the schtasks command. To schedule a server restart you should run the following command line:
This command will create a scheduled task that will run once at 22:00 and execute a forced reboot of the server/computer you have created the task on. If you prefer to use the graphic user interface to check up on your newly created task or to change the time it will run, you can use the Windows Task scheduler. You can of cause also remove a task with schtasks, like in the example below:
The smart thing about scripting this command instead of using the Task scheduler GUI is that you can run other command line tools first and then finish with a server reboot then the task is done, but you can of cause also use the Task Scheduler GUI if you are more comfortable using that.
I hope you found what you were looking for in this post. If you have any questions, please drop me a comment below.