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:
Screenshot of the Windows Run dialog box with the dsa.msc command to open the Active Directory Users and Computers console.
  • Move Users for whom we wish to activate automatic shut down to an OU (Organizational Unit):
Screenshot of Active Directory Users and Computers showing a GPO USERS organizational unit with a user account.
  • Then open the Group Policy Manager console:
Screenshot of the Windows Run dialog box with the gpmc.msc command to open the 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…:
Screenshot of Group Policy Management with the option to create a GPO in the domain and link it to an organizational unit.
  • Give the new GPO a name:
Screenshot of the New GPO creation window with the name Auto_Shutdown and no starter GPO selected.
  • Edit the GPO:
Screenshot of Group Policy Management with the Edit option highlighted for the 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):
Screenshot of Group Policy Management Editor with the option to create a new Scheduled Task (At least Windows 7) highlighted.

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). Screenshot of the Auto_Shutdown task properties window with general settings, security options, and user account configuration.
  • In the Triggers tab, click on New:
Screenshot of the New Task properties window with the Triggers tab open and the New button highlighted to create a trigger.
  • Specify the time at which the computers will shut down:
Screenshot of the New Trigger window with a daily schedule set to recur every 1 day at 4:20 PM.
  • In the Actions tab, click on 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
Screenshot of the New Action window with the shutdown.exe program configured to shut down the computer using the /s /t 0 argument.
  • In the Conditions tab:

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

Screenshot of the Auto_Shutdown task properties Conditions tab with options to start the task if the computer is idle for 30 minutes.

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:
Screenshot of Task Scheduler showing the Auto_Shutdown task with details such as status, triggers, and security options configured.

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