Almost All Scheduled Tasks Fail: The system cannot find the file specified. (0x80070002)

3

In Windows 7 x64 I am attempting to create a scheduled task that runs a PowerShell script, but no matter what I try, it fails with the error: "The system cannot find the file specified."

And then I noticed that many other scheduled tasks (Google updater, MS Office stuff, etc) were all failing with the same error.

So I simplified things, and created a straightforward task that does nothing more than run notepad:

  • General Tab

General Tab

  • Triggers Tab = No triggers.

  • Actions Tab

Actions Tab

  • Conditions Tab

Conditions Tab

  • Settings Tab

Settings Tab

When I run this task, I get the same error, "The system cannot find the file specified. (0x80070002)"

I have confirmed that notepad.exe exists in the c:\windows\system32 location, and that it is a working executable. In fact, all of the tasks that are failing with that error appear to have legit paths and executables.

This makes me think there is something bigger at work here, like a hosed task scheduler, maybe a Windows Update patch that mucked about with the task scheduler workings.

What could cause this, and/or what are my next troubleshooting steps?

windows-7
scheduled-task
asked on Server Fault Jan 15, 2019 by Shoeless • edited Jan 15, 2019 by HBruijn

2 Answers

3

Since there is no answer at all, I answer how I would break it down:

  • create the task with a uniqe name
  • run procmon.exe
  • search for the name of the task (you will find a svchost.exe)
  • rightcklick PID (process ID) and choose include ...
  • disable Show registry activity in the menubar
  • choose Tools \ count occurances
  • Select result in Column and klick count
  • There should be NAME NOT FOUND value, doublecklick it to filter only this result
  • Check the filtered events

enter image description here

answered on Server Fault Jan 16, 2019 by marsh-wiggle
1

I had the same problem, but another cause. So my solution won't help the asker, but may be others that come to this question.

In my case, my environment variables were broken and my system was not able to launch PowerShell just by calling powershell or powershell.exe. After adding %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\ to the PATH environment variable, it was working again and the scheduled tasks ran successfully.

answered on Server Fault Mar 11, 2021 by stackprotector

User contributions licensed under CC BY-SA 3.0