Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why windows 7 task scheduler task fails with error 2147942667

I have scheduled a task to lauch a batch file. When I run the task with the option

Run only when user is logged on

everything works fine.

I want to run this task in the background, hence I am running it using the option

Run whether user is logged on or not.

Now when I run the task under that parameter, it is not working. I get the following 2 errors:

  • Task Scheduler failed to launch action "C:\Windows\SYSTEM32\cmd.exe" in instance "{2a7cc950-fad9-4633-9701-af75a0fd220d}" of task "\stmm\Daemon". Additional Data: Error Value: 2147942667.
  • Task Scheduler failed to start instance "{2a7cc950-fad9-4633-9701-af75a0fd220d}" of "\stmm\Daemon" task for user "GBLADHEDANI\N011940" . Additional Data: Error Value: 2147942667.

What is Error Value: 2147942667? How can I resolve this errors?

like image 566
Alok Avatar asked Oct 14 '22 12:10

Alok


2 Answers

To get the relevant error message:

  1. Convert 2147942667 to hex: 8007010B
  2. Take last 4 digits (010B) and convert to decimal: 267
  3. In a Command Prompt, run net helpmsg 267
  4. Result: "The directory name is invalid."

Command Prompt Window

The solution for me was that I had quotes in the "Start In" field. I found this information in Microsoft KB Article 2452723, Windows Vista onward scheduled tasks fail to run if the path in "Start in (Optional)" field has quotes.

Basically, edit your scheduled task and take the quotes out of the "Start In" field:

  1. Open your Scheduled Task
  2. Switch to "Actions" tab
  3. Open your Action
  4. Remove Quotes (") from the field "Start in (optional)"
  5. Save and close all open dialogs

Edit Action Dialog Box

You should also check for other causes of the error, like not having permission to access the directory, or using a mapped drive letter which is only available during certain login sessions.

like image 298
jp2code Avatar answered Oct 17 '22 01:10

jp2code


For me it was the "Start In" - I copied the values from an older server, and updated the path to the new .exe location, but I forgot to update the "start in" location - if it doesn't exist, you get this error too

Quoting @hans-passant 's comment from above, because it is valuable to debugging this issue:

Convert the error code to hex to get 0x8007010B. The 7 makes it a Windows error. Which makes 010B error code 267. "The directory name is invalid". Sure, that happens.

like image 11
user230910 Avatar answered Oct 17 '22 01:10

user230910