|
| 1 | +--- |
| 2 | +title: Scheduled Tasks Fail with Error Task Schedular Service Is Not Available |
| 3 | +description: Helps resolve the error Task schedular service is not available in which scheduled tasks fail. |
| 4 | +manager: dcscontentpm |
| 5 | +ms.date: 04/22/2025 |
| 6 | +ms.topic: troubleshooting |
| 7 | +ms.reviewer: kaushika, warrenw, mamash, v-lianna |
| 8 | +ms.custom: |
| 9 | +- sap:system management components\task scheduler |
| 10 | +- pcy:WinComm User Experience |
| 11 | +--- |
| 12 | +# Scheduled tasks fail with error "Task schedular service is not available" |
| 13 | + |
| 14 | +This article helps resolve the issue in which your scheduled tasks fail to run with error "Task schedular service is not available." |
| 15 | + |
| 16 | +Some of your scheduled tasks fail to run. When you open Task Scheduler to investigate the failure, you receive the following error message: |
| 17 | + |
| 18 | +> Task schedular service is not available. Task Scheduler will attempt to reconnect to it. |
| 19 | +
|
| 20 | +This issue is caused by the following reasons: |
| 21 | + |
| 22 | +- Incorrect scheduled task configurations. |
| 23 | +- Scheduled task target application or script is no longer available or valid. |
| 24 | +- Incompatible scheduled tasks after recent operating system (OS) upgrade. |
| 25 | + |
| 26 | +Use the following steps to resolve the issue: |
| 27 | + |
| 28 | +1. Clean up `at` tasks if they exist. |
| 29 | +2. Delete corrupted tasks and then create them again if needed. |
| 30 | + |
| 31 | +## Step 1: Clean up at tasks if they exist |
| 32 | + |
| 33 | +> [!NOTE] |
| 34 | +> [At](/windows-server/administration/windows-commands/at) tasks refer to tasks scheduled to run automatically by the OS using the `at` command. It's a legacy command in Windows for scheduling tasks at specified time and date. These tasks are managed by the Task Scheduler service. After an OS upgrade, such tasks might fail due to compatibility issues or problems with the Task Scheduler service. This might affect the successful launch of Task Scheduler. |
| 35 | +
|
| 36 | +Check the **C:\\Windows\\System32\\Tasks** folder to determine if you have any `at` tasks created under Task Scheduler. If so, the tasks are listed under the following locations. For example: |
| 37 | + |
| 38 | +- **C:\\Windows\\System32\\Tasks** |
| 39 | + - **C:\\Windows\\System32\\Tasks\\At1** |
| 40 | + - **C:\\Windows\\System32\\Tasks\\At2** |
| 41 | + |
| 42 | +- **C:\\Windows\\Tasks** |
| 43 | + - **C:\\Windows\\Tasks\\At1.job** |
| 44 | + - **C:\\Windows\\Tasks\\At2.job** |
| 45 | + |
| 46 | +To resolve this issue, clean up the legacy tasks by using the following steps: |
| 47 | + |
| 48 | +[!INCLUDE [Registry important alert](../../includes/registry-important-alert.md)] |
| 49 | + |
| 50 | +1. Stop the Task Scheduler service: |
| 51 | + |
| 52 | + 1. Download [PsTools](/sysinternals/downloads/pstools) and extract the file. |
| 53 | + 2. Go to the extracted PsTools directory and run the following command from an administrative Command Prompt (**cmd.exe**) window: |
| 54 | + |
| 55 | + ```console |
| 56 | + psexec.exe -s -i cmd.exe |
| 57 | + ``` |
| 58 | + |
| 59 | + 3. After you accept the end-user license agreement (EULA), another **cmd.exe** process opens. Type `whoami` in the command prompt, and you should receive the output `nt authority\system`. |
| 60 | + 4. Run this command: |
| 61 | + |
| 62 | + ```console |
| 63 | + net stop schedule |
| 64 | + ``` |
| 65 | + |
| 66 | +2. After the Task Scheduler service is stopped successfully, delete the files for `at` tasks after backup if they exist. Here are some examples: |
| 67 | + |
| 68 | + - **C:\\Windows\\System32\\Tasks** |
| 69 | + - **C:\\Windows\\System32\\Tasks\\At1** |
| 70 | + - **C:\\Windows\\System32\\Tasks\\At2** |
| 71 | + |
| 72 | + - **C:\\Windows\\Tasks** |
| 73 | + - **C:\\Windows\\Tasks\\At1.job** |
| 74 | + - **C:\\Windows\\Tasks\\At2.job** |
| 75 | + |
| 76 | +3. Clear the schedule entries from the registry: |
| 77 | + |
| 78 | + 1. Open Registry Editor as administrator. |
| 79 | + 2. Go to `HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tasks`, and back up the `Tasks` folder before proceeding with the next steps. |
| 80 | + 3. Delete the keys ending in `{1}`, `{2}`, `{3}` … or more if they exist. Those keys have the property `Path` set to `\\At<#>`, for example: |
| 81 | + |
| 82 | + - `HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tasks\{1}` |
| 83 | + |
| 84 | + `Path`=`\\At1` |
| 85 | + |
| 86 | + - `HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tasks\{2}` |
| 87 | + |
| 88 | + `Path`=`\\At2` |
| 89 | + |
| 90 | + 4. Delete the following keys if they exist: |
| 91 | + |
| 92 | + - `HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tasks\{xxxxxxxx-EC79-4064-9831-xxxxxxxxxxxx}` |
| 93 | + - `HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tasks\{xxxxxxxx-FB9E-4BDD-8FED-xxxxxxxxxxxx}` |
| 94 | + |
| 95 | + 5. Go to `HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree`, and delete the keys ending in `At1`, `At2`, `At3` … or more if they exist. Those keys end with `At<#>`, for example: |
| 96 | + |
| 97 | + > [!IMPORTANT] |
| 98 | + > [Back up](https://support.microsoft.com/topic/855140ad-e318-2a13-2829-d428a2ab0692) the `Tree` key before proceeding with the next steps. |
| 99 | + |
| 100 | + - `HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\At1` |
| 101 | + - `HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\At2` |
| 102 | + |
| 103 | +4. Go back to the command prompt opened using the `psexec` command, and then run the following command to start the Task Scheduler service: |
| 104 | + |
| 105 | + ```console |
| 106 | + netsh start schedule |
| 107 | + ``` |
| 108 | + |
| 109 | +## Step 2: Delete corrupted tasks and then create them again if needed |
| 110 | + |
| 111 | +If you clean up the `at` tasks or you don't have `at` tasks, you might have corrupted tasks that cause this issue. Find the corrupted tasks, delete them, and then create them again if needed. |
| 112 | + |
| 113 | +1. Find the corrupted tasks: |
| 114 | + |
| 115 | + 1. Open Task Scheduler, and acknowledge the first error message to get into the Task Scheduler console. |
| 116 | + 2. Expand the Task Scheduler Library structure. |
| 117 | + 3. Select each folder object and observe if any of them produce the following error message: |
| 118 | + |
| 119 | + > The selected task "{0}" no longer exists. To see the current tasks, click Refresh. |
| 120 | + |
| 121 | + 4. Take a note of each task that produces this error message. |
| 122 | + 5. Once you go through all folders and subfolders within Task Scheduler, you're ready to delete the corrupted tasks. |
| 123 | + |
| 124 | +2. Delete the corrupted tasks: |
| 125 | + |
| 126 | + [!INCLUDE [Registry important alert](../../includes/registry-important-alert.md)] |
| 127 | + |
| 128 | + > [!NOTE] |
| 129 | + > Before you proceed with the following steps, back up the following items: |
| 130 | + > |
| 131 | + > - The folder **%SYSTEMDRIVE%\\Windows\\System32\\Tasks** |
| 132 | + > - The registry key `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\` |
| 133 | + |
| 134 | + 1. Delete the task file that corresponds to the corrupted task from the Tasks folder (**%SYSTEMDRIVE%\\Windows\\System32\\Tasks**). |
| 135 | + 2. Go to the registry subkey `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree`. Note down the `Id` value (in GUID format) of each task that needs to be deleted corresponding to the corrupted task. |
| 136 | + |
| 137 | + Delete the registry subkey that corresponds to the corrupted task from `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree`. |
| 138 | + |
| 139 | +3. Delete the registry subkey that corresponds to the corrupted task from `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tasks`. |
| 140 | + |
| 141 | +4. Delete the registry subkey that corresponds to the corrupted task from one of the following locations: |
| 142 | + |
| 143 | + > [!NOTE] |
| 144 | + > The task exists in only one of the three locations and is in GUID format. |
| 145 | + |
| 146 | + - `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Plain` |
| 147 | + - `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Logon` |
| 148 | + - `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Boot` |
| 149 | + |
| 150 | +## Contact Microsoft Support |
| 151 | + |
| 152 | +If the preceding steps can't resolve the issue, contact Microsoft Support for further assistance. |
0 commit comments