In this blog, I will walk you through how to schedule Windows reboot with Group Policy. This guide will be compatible with a Windows Server 2022 or a client operating system (Windows 10, 11).
Creating Group Policy to Schedule Windows Reboot
From a domain controller, create a group policy on the OU that includes the computers you want to restart, right-click on it, click Create a GPO in this domain, and link it here.
Name the Group Policy and click the ok button.
Edit the group policy, which has just been created, right-click on it and select Edit.
Go to the following location:
Computer Configuration/Preferences/Control Panel Settings/Scheduled Tasks
Right-click on scheduled tasks, click go to New and then click on Scheduled task (at least Windows 7).
On the General tab, name the task and indicate the user NT AUTHORITYSYSTEM.
We will now configure the triggers of the scheduled task. Select the Triggers tab and click on the New button.
Specify a scheduled time, select Daily to configure the execution time as per the requirement and click on ok to create the trigger.
The trigger is added.
Now, we are going to add our action, to restart a Windows computer. Select the Actions tab and click on New.
Action: choose Start a program
In the Program/script field: Type the below path:
C:WindowsSystem32shutdown.exe
Specify the following parameters: -s -t 0 -f to configure computer shutdown.
(f for shutdown and type r for restart)
Click OK
Select Apply and OK.
The scheduled task is added.
Our scheduled task is almost ready, and we need to configure the task to operate with the user not logged in and the highest privileges.
Open the task by double-clicking on it; as shown in the screenshot below, the user has been changed.
Specify the NT AUTHORITYSYSTEM user again.
Select whether the user is logged in or not
Check the box Run with highest privileges.
Click OK
Group Policy is ready.
How to Verify Group Policy on a Computer
From a PC where group policy applies, use the gpupdate /force command to update the GPOs and then restart the computer. From a PC where group policy applies, use the gpupdate /force command to update the GPOs and then restart the computer.
After restarting the system, log in to the task scheduler and then the task scheduler; you must open the task scheduler as an administrator, otherwise, you will only see the scheduled tasks of the logged-in user.
As we can see, the scheduled task has been added, and the computer will automatically reboot every day as you configured it.
Conclusion:
In this blog, you have learned how to create a group policy to create a scheduled task and how to program the automatic restart or shutdown of computers.
This solution effectively allows the automatic shutdown of computers at a scheduled time; however, it is not possible to stop the task if, for some reason x or y, a user is still working on the computer. will be turned off.