User Tools

Site Tools


windows:scheduledtaskswithoutbeingadmin

How to run scheduled tasks without being administrator

THIS PROCEDURE FAILED TO ME: I accept suggestions to anyone about what I am doing bad.

When I first tried to run a scheduled task without being an administrator, I thought that it was an easy task: just create the task, add the user in the run-as entry in the corresponding entry in the scheduled task, and voila!!!

After puzzling myself by the first fails, and discovering that it is not an easy task, I searched in internet (as many of the visitors of this page are doing right now, uh??) and discovered that it is an issue not well docummented also. Only two meaningful references honour the “util” label:

Conventions

  • batch: the user who will run the scheduled task
  • d:\batch\test.bat: the command to run

First step: create the user

Create the user batch and add it to the users group.

Second step: give him rights

Check that the user batch have the rights Log on as batch user and Log on as a service.

Third step: give him NTFS rights

Open a command prompt as the user batch –click on start → programs → accesories → right click over “command prompt” and select “run as”– and test that it can run the command d:\batch\test.bat: for this, you have to ensure that the proper NTFS permissions are in place.

Second, ensure that this user have access to the folder c:\windows\tasks to run the scheduled tasks. In windows 2003 the security tab of this folder do not appear. For make appear this folder, you have to try to move the folder to another location: some of the files will move, but others failed to move. However, the security tab in c:\windows\tasks will appear.

You have to give permissions to the user batch to traverse this foler (read and execution will be enough), and ensure through the command prompt of this user that it can. In the following image is an example using the jboss user instead of the batch user:

tasks_traversal.jpg

Third, back the part of the “tasks” folder you moved again to the windows directory. Again, the security tab will disappear (if you are fortunate, this problem will be fixed and you haven't to this stuff).

Fourth step: create the scheduled task

Create the scheduled task ensuring that you put the user batch in the “run as” field.

Fifth step: checking permissions again

Control panel → scheduled tasks, right-click over the created task and go to the “security” tab. Again, check that the user batch have permissions of execution and reading.

Sixth step: test run

Of course, you have to do a test run: right-click over the created task and select “run” to see if things are going well.

windows/scheduledtaskswithoutbeingadmin.txt · Last modified: 2022/12/02 22:02 by 127.0.0.1