Error running a Windows Scheduled Task under System Account
Asked Answered
H

4

6

I want to create a scheduled task to run under the "LOCAL SERVICE" account. The task will call a C# program (.NET 4.5). To do a POC, i kept the C# program to be simple - one that just writes a text to a Console.

The taskscheduler task is set to run when not logged on. I have made sure that the c# executable has permissions for the LOCAL SERVICE (Read, REad and Execute).

When I run the scheduled task, i get the below error in the event log:

Task Scheduler failed to start instance "{e719a65e-d4fb-4515-9fc9-3635fe69e378}" of "\Testing LOCAL SERVICE" task for user "NT AUTHORITY\LOCAL SERVICE" . Additional Data: Error Value: 2147942405.

However, if I run the same task under LOCAL SERVICe by pointing to known programs like mspaint or notepad, the task runs without errors. I am not sure what is so specific with permissions for the C# program.

Appreciate some thoughts on this.

Heartland answered 14/9, 2014 at 6:32 Comment(3)
Unable to reproduce what you describe. You do not need to set any permissions on the exe but it must be on a local disk.Giffard
For reference, 2147942405 = 0x80070005 = COR_E_UNAUTHORIZEDACCESS You should verify that the program - .exe file and containing folder - has permissions. Also verify that it's really local - mapped network drives only apply to the user session that created them.Follower
The .exe is on a local drive (c:\TestFolder). The .exe and the containing folder have Read/Execute permissions for the LOCAL SERVICE user. Thanks for confirming my research that it is related to some access issue....but looks like I have the required permissions.Heartland
G
3

The user used to run the task must have right permission on the folder that host the .exe file. Right click on the folder > Properties > Security > Edit > Add > And try to add "full control" permission.

enter image description here

Gerita answered 10/8, 2021 at 15:40 Comment(0)
C
0

From here: Task Scheduler failed to start. Additional Data: Error Value: 2147943726. What does this mean?

The change of password has a role causing that error.

The quickest fix:

In Task Scheduler, open the scheduled job properties, go to settings.

screenshot

The last listed option should read, "If the task is already running, the following rule applies:"

Select "Stop the existing instance", click OK and exit.

This should fix it.

Centroid answered 10/9, 2015 at 18:24 Comment(0)
A
0

I having the same error code "2147942405" when I change the User. At the end, I managed resolved it by enable the "Run with highest privileges"

enter image description here

Athematic answered 27/1, 2021 at 7:56 Comment(0)
E
0

In my case I was running the app from a shared folder on a network drive that had all the correct permissions. As noted in the comments, I moved the .exe file to a local drive, changed the Action > Start a program > Program/script and it worked.

Eltonelucidate answered 19/10, 2024 at 20:13 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.