Fix SCHED_E_TASK_NOT_RUNNING (0X8004130B) Fast
You're getting 'There is no running instance of the task' when trying to stop a scheduled task. Here's how to kill it for real.
Yeah, that error is annoying. You click "End" on a task in Task Scheduler, and it tells you there's no running instance. But the task is clearly listed as running. You're not crazy — Windows just lost track of the real process.
The Real Fix: Kill the Process Manually
Skip the GUI. Open Command Prompt as Administrator and run this:
schtasks /end /tn "\Microsoft\Windows\YourTaskName"
Still get the same error? Then the task is orphaned — the task object thinks it's running, but the actual process died without updating the scheduler. In that case, you need to find and kill the underlying process by name or PID.
- Open Task Manager (Ctrl+Shift+Esc).
- Go to Details tab.
- Look for the executable your task runs — common ones are
cmd.exe,powershell.exe,wscript.exe, or a custom app likebackup.exe. - Right-click and choose End Task.
If there are multiple instances, check the command line column to find the exact one. You can also use this in CMD:
tasklist /v | findstr "YourTaskName"
Then kill it:
taskkill /f /im yourprocess.exe
Why This Happens
Task Scheduler tracks task state in memory. When a task starts, it stores the PID. If that PID terminates unexpectedly — say the app crashes, or a user closes the window — the scheduler doesn't always get the message. The state flips to "Running" but no process exists. The schtasks /end call checks for a real process, finds none, and spits out that error.
Had a client last month whose backup script crashed because of a permissions change. The task stayed "Running" for three weeks. Every time they tried to end it, same error. Took me two minutes to kill the orphaned state with schtasks /change /disable and re-enable it.
Variations on the Same Problem
1. Task Shows Running After Reboot
If the task still shows "Running" after a system restart, the task state is stored in the registry. Open regedit and go to:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tasks
Find your task GUID — you'll see it in the right pane under Path. Delete the DynamicInfo subkey for that task. This resets the state without removing the task definition.
2. Multiple Instances of Same Task
Sometimes you see two or three instances of the same task. That means older processes didn't die. Use taskkill /f /fi "IMAGENAME eq yourtask.exe" to blast them all at once.
3. Task Refuses to Stop Even After Kill
If the task starts again immediately — probably it's set to "Run whether user is logged on or not" and the trigger is still active. Disable the trigger or the task itself first:
schtasks /change /disable /tn "\YourTask"
Then kill the process.
Prevention: Keep Tasks Clean
- Set a timeout. In the task's Settings tab, check "If the running task does not end when requested, force it to stop". Also set "Stop the task if it runs longer than" to a reasonable limit (e.g., 1 hour).
- Use proper start and end triggers — not just "At startup" unless the task is meant to run forever.
- Monitor task history in Event Viewer under
Applications and Services Logs/Microsoft/Windows/TaskScheduler/Operational. Look for event IDs 129 (task start) and 102 (task stop). If you see starts without stops, something's wrong. - Don't let tasks spawn child processes that survive the parent. If your task launches a script that spawns a background job, the parent might exit but the child keeps running. Kill the whole tree with
taskkill /t.
That's it. Next time you see that error, you know it's a ghost process. Kill the process or wipe the registry state, and move on.
Was this solution helpful?