Tag: windowsreboot

  • How to Schedule Windows Reboot with Group Policy

    How to Schedule Windows Reboot with Group Policy

    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.

    Create a GPO in this domain and link it here

    Name the Group Policy and click the ok button.

    Create new group policy object

    Edit the group policy, which has just been created, right-click on it and select Edit.

    Edit GPO to schedule reboot windows server

    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).

    Scheduled task to restart Windows automatically

    On the General tab, name the task and indicate the user NT AUTHORITY\SYSTEM.

    Schedule Windows reboot with Group Policy

    We will now configure the triggers of the scheduled task. Select the Triggers tab and click on the New button.

    Create trigger to schedule restart windows

    Specify a scheduled time, select Daily to configure the execution time as per the requirement and click on ok to create the trigger.

    Create new trigger to schedule reboot

    The trigger is added.

    Schedule windows reboot via group policy

    Now, we are going to add our action, to restart a Windows computer. Select the Actions tab and click on New.

    Create action to schedule windows reboot

    Action: choose Start a program
    In the Program/script field: Type the below path:

    C:\Windows\System32\shutdown.exe

    Specify the following parameters: -s -t 0 -f to configure computer shutdown.
    (f for shutdown and type r for restart)
    Click OK

    Schedule reboot windows with group policy

    Select Apply and OK.

    Schedule reboot windows via group policy

    The scheduled task is added.

    Windows reboot automatically using group policy

    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.

    Schedule reboot windows properties

    Specify the NT AUTHORITY\SYSTEM user again.
    Select whether the user is logged in or not
    Check the box Run with highest privileges.
    Click OK

    Reboot windows automatically schedule

    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.

    Gpupdate /force command

    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.

    Task scheduler library

    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.