Sometimes you may be required to automatically shut down domain-joined client computers or you may be required to run a script at some specific time. Group policies and task scheduling can help you in such situations.
This tutorial will help you to learn how to schedule a task using group policies in domain controller on Windows Server 2008, Server 2012 R2, and Server 2016.
Step-By-Step instructions to setup a scheduled task
- Open the group policy management console.
- Right-click your domain and then click "Create a GPO in this domain, and Link it here ..".
- Give a name to this newly created GPO and click OK.
- Right-click this newly created GPO and then click Edit.
- Expand computer or user configuration and then go to the following path:
Preferences -> Control Panel Settings -> Scheduled Tasks
- Right-click on scheduled tasks and then click New -> Scheduled Task.
- In the new task properties dialog box, provide the details of this task including action (choose create), run (choose script file), arguments (if any), comments, credentials and check Enabled at the bottom.
- Open schedule tab and set the schedule for this task to run.
- Click Apply and then click OK.
- Execute the gpupdate on the command prompt to apply the changes.