rss logo

How to schedule automatic computer shut down with Group Policy

Microsoft logo

In the corporate world, every system administrator knows that it's more than common for users to forget to turn off their computers before leaving the office in the evening… Aware of this, and with a view to save our planet and a few dolphins, it is possible to automaticaly shut down computers at a specific time using a group policy (GPO).

Create Group Policy Object

  • From a Domain Controller, open the Active Directory Users and Computers management console:
Windows Run dialog with dsa.msc command for administrative privileges
  • Move Users for whom we wish to activate automatic shut down to an OU (Organizational Unit):
Active Directory Users and Computers window with GPO USERS folder selected
  • Then open the Group Policy Manager console:
Windows Run dialog with gpmc.msc command for opening Group Policy Management Console
  • Right-click on the OU where the users are located, then click on Create a GPO in this domain, and Link it here…:
Group Policy Management window with option to create and link a GPO in the domain selected
  • Give the new GPO a name:
New GPO creation window with Auto_Shutdown as the name and no starter GPO selected
  • Edit the GPO:
Group Policy Management window with Edit option selected for Auto_Shutdown GPO
  • Go to User Configuration > Preferences > Control Panel Settings then right-click on Scheduled Tasks to open New > Scheduled Tasks (At least Windows 7):
GPO New Scheduled Task

Set up the Group Policy Object

  • Define the properties of the New Task:
    • Action: Create
    • Name: Auto_Shutdown
    • User Account: System (⚠️ Just write it, don't use "Change User or Group… button.⚠️)
Note: we can also use the universal SID code for System, which is: S-1-5-18 (source: learn.microsoft.com). Auto_Shutdown task properties window in Task Scheduler with general settings configured
  • In the Triggers tab, click on New:
New Task properties window in Task Scheduler with New trigger button highlighted
  • Specify the time at which the computers will shut down:
New Trigger window in Task Scheduler with daily schedule and advanced settings configured
  • In the Actions tab, click on New:
New Task properties window in Task Scheduler with New action button highlighted
  • 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
New Action window in Task Scheduler with Start a program option and shutdown command configured
  • In the Conditions tab:

It avoids shutting down a computer if a user is still working (called overtime).

Conditions tab of a Windows Create Scheduled Task window.

Check from a user workstation

  • From a workstation, open the task scheduler with administrator rights (otherwise you won't be able to see the task), you should see the Auto_Shutdown task:
Task Scheduler window with Auto_Shutdown task details and next run time displayed

Note: To prevent the task from installing on servers, I also recommend using the WMI Filters so that the GPO only applies to client workstations.

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Contact :

contact mail address