Sometimes we need to schedule the reboot of a server after hours.
We can do this very easy with Task scheduler and PowerShell.
Open Task Scheduler and create a new basic task. Give it a meaningful name:
And press Next.
Set it to One time and press Next:
Set the date and time for the reboot, then press Next:
Choose Start a program, then press Next:
On the program name put Powershell and for the arguments put restart-computer –force, then press Next:
After that the task is created, but it will not run if we logoff from the server:
Now we need to edit the task and make it run even if the user is not logged on and with highest privileges:
Enter your user and password, then press OK:
The task is now set and will reboot the server at the given time.
Enjoy your time and the server will reboot itself.
If you need to send a email prior to the reboot I have an article about this here.