A Quick Tip Restrict Users From Modifying The Schedule Tasks

by [Published on 17 Nov. 2010 / Last Updated on 10 Oct. 2009]

This article explains how you can restrict users from deleting a schedule task created by an administrator

Group Policy does not provide any policy settings to hide Schedule Tasks created by an administrator or applications. You need to use a small script to accomplish this. This article explains how you can do this using a small script.

As an example, you are domain administrator. You need to create a schedule task to perform a couple of tasks on all the client computers and need to make sure users and local administrators are not able to delete this task. To accomplish this, you need to hide the task and remove the permissions for local administrators group. This article assumes you have the commands written in TaskFile.CMD and is already copied to the C:\Windows\System32 directory on all the client computers.

1. Create a CMD file by name: Tasks.CMD and then put the following lines in it:

  • REM ***  START ***
  • @ Echo off
  • C:\Windows\System32\Schtasks.exe /Create /s \\%COMPUTERNAME% /tn "Task_Name" /tr C:\Windows\System32\TaskFile.CMD /sc onidle /i 60 /ru "NT Authority\System"
  • Echo Y|C:\Windows\System32\Cacls.exe C:\Windows\Tasks\Task_Name.JOB /G SYSTEM:F
  • REM *** END ***

2. Edit or create a Group Policy Object and put the Tasks.CMD in Startup Script.

The above script will create a task by name Task_Name. The task runs the TaskFile.CMD file which you copy to client computers and runs when computer is idle for 1 hour. You can change this as per your requirement.

The next line in script assigns SYSTEM account Full Control permissions removing any other account from the property of the task. This way local users, domain users and even local administrators cannot see the task when they go to Schedule Tasks folder.

See Also

The Author — Nirmal Sharma

Nirmal Sharma avatar

Nirmal Sharma is a MCSEx3, MCITP and was awarded the Microsoft MVP award in Directory Services and Windows Networking. He specializes in Microsoft Azure, Office 365, Directory Services, Failover Clusters, Hyper-V, PowerShell Scripting and System Center products. Nirmal has been involved with Microsoft Technologies since 1994. In his spare time, he likes to help others and share some of his knowledge by writing tips and articles on various sites and contributing to PowerShell-based Dynamic Packs for www.ITDynamicPacks.Net solutions.

Featured Links