Another one of those “this has been bugging me for ages” things. Sometime *ages* ago one of my servers had an unexpected shutdown (crash/bugcheck whatever). After it came back up and all the various repair and recovery stuff completed it was back to normal… more or less.
One thing that started happening was that the task scheduler would throw an error “Task Scheduler is not available. Task Scheduler will attempt to reconnect to it.” every time it was opened, and some scheduled tasks didn’t always seem to trigger.
Overall I didn’t bother about it too much as I planned to decommission the server anyway. One and a half years later, the server is still going :sigh:
Hunting around for Task Scheduler related settings eventually led me to this Registry branch: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree
Which follows the list of scheduled tasks you see through the Task Scheduleder GUI. The ID’s are then pointers to task details under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tasks
Note: Usual cautions apply. Editing the registry can break things, and the changes below worked for me. Your results may vary, so caution and backups should be applied before making changes.
- Close the Task Scheduler GUI if it is open
- First, export a copy of the “Tree” and “Tasks” Keys. If you mess something up you can just re-import them to set things back to before
- Right-click “Tree” and select permissions. Add “Full Control” to the Administrators group
- This will not be easily reversible, so expect to leave this in place once finished
- Rename each of the Keys under Tree one at a time. e.g. add .bak to each entry (Microsoft -> Microsoft.bak)
- After each rename, start the GUI
- When the error does not appear, note the last entry that was renamed
- If the “problem” entry was a folder, then name it back to normal and repeat the process on the subfolders until the actual task is found
- Once the problem task has been found, then leave it renamed and recreate it in the GUI
If the task is one of the Microsoft default ones, it may be possible to “restore” it using the steps in the following article:
If the file in your tasks folder is Zero bytes or corrupted, then you can get a copy of the file from another computer running the same OS and version. Copy it from the other machine to a temp location and import from there.