rss logo

How to Schedule Automatic Shutdown or Reboot with Group Policy

Microsoft logo

In corporate environments, it's all too common for users to forget to shut down their computers before leaving the office. To address this—and in the interest of saving our planet (and perhaps even a few dolphins)—you can use a Group Policy Object (GPO) to automatically shut down Windows computers at a scheduled time.

In some scenarios, you may need to configure a scheduled reboot to periodically maintain Windows workstations and their services. This guide also demonstrates how to restart computers using Group Policy through a scheduled task rather than shutting them down.

Create a Group Policy Object (GPO) in Active Directory

  • On a Domain Controller, open the Active Directory Users and Computers management console:
Run dialog showing the 'dsa.msc' command to open Active Directory Users and Computers.
  • Move the users for whom you want to enable automatic computer shutdown into an appropriate Organizational Unit (OU):
Active Directory console showing a 'GPO USERS' organizational unit with a user account.
  • Next, open the Group Policy Management console:
Run dialog showing the 'gpmc.msc' command to open Group Policy Management Console.
  • Right-click the target OU, then select Create a GPO in this domain, and Link it here…
Group Policy Management interface showing the option to create and link a GPO to an organizational unit.
  • Assign a name to the new Group Policy Object (GPO):
New GPO creation window showing 'Auto_Shutdown' as the name, with no starter GPO selected.
  • Edit the Group Policy Object (GPO) to configure its settings:
Group Policy Management with the Edit option selected for the 'Auto_Shutdown' GPO.
  • Navigate to User Configuration > Preferences > Control Panel Settings, then right-click Scheduled Tasks and select New > Scheduled Task (At least Windows 7):
Group Policy Management Editor with the option to create a new scheduled task for at least Windows 7.

Configure the Group Policy Object (GPO)

  • Set the properties of the new scheduled task as follows:
    • Action: Create
    • Name: Auto_Shutdown
    • User Account: System (⚠️ Type it manually; do not use the “Change User or Group…” button ⚠️)

đź’ˇ Note: You can also use the System account universal SID: S-1-5-18 (source: learn.microsoft.com).

Task properties for Auto_Shutdown showing general settings and user account configuration.
  • Under the Triggers tab, click New:
Triggers tab in Task Properties window with the 'New' button highlighted.
  • Set the time when the computers should shut down:
New Trigger window showing a daily schedule set to 4:20 PM.
  • In the Actions tab, click New:
Screenshot of the New Task properties window with the Actions tab open and the New button highlighted to create a new action.
  • Define the properties of the New Action as follows:
    • Action: Start a program
    • Program/script: C:\Windows\System32\shutdown.exe
    • Add arguments(optional): /s /t 0

đź’ˇ Note: To reboot the computer instead of shutting it down, replace /s /t 0 with /r /t 0.

New Action window with shutdown.exe configured using the arguments '/s /t 0'.
  • In the Conditions tab, configure the task to prevent shutdown while a user is still active:

This ensures that the shutdown occurs only when the computer is idle, avoiding interruptions during user activity (for example, when working overtime).

Conditions tab of the Auto_Shutdown task, set to start only if the computer is idle for 30 minutes.

Verify the Scheduled Task on a User Workstation

  • On a client workstation, open the Task Scheduler with administrator privileges. (Without administrative rights, the task may not be visible.) You should see the Auto_Shutdown scheduled task listed:
Task Scheduler showing the Auto_Shutdown task with status, triggers, and security options.

đź’ˇ Note: To prevent the task from being deployed on servers, consider using WMI Filters to ensure the GPO applies only to client workstations.