Repair "Corrupted/Tampered With" Scheduled Tasks.

This script properly removes and re-adds scheduled tasks on a computer when those tasks are reported as "The task image is corrupt or has been tampered with". It does require a little bit of up front configuration by the administrator of that computer.

4.3 Star
15,742 times
Add to favorites
Operating System
E-mail Twitter Digg Facebook
Sign in to ask a question

  • Windows 7
    4 Posts | Last post May 29, 2017
    • Hi, can you please make a version of this for Windows 7. I keep hitting the same issue with corrupted tasks, but on Windows 7 instead of server. Thanks in advance.
      There is no SetACL on Windows 7 and I also see "Access denied" errors even when executing the script as admin.
    • I do not have a Windows 7 machine experiencing this issue, so I cannot make a Windows 7 version.
      I suggest you follow the detailed sub-steps in step 4 to create your own list of tasks. I believe some corrupted tasks will be the same between the two versions, so hopefully the ones in the current script can be recycled and provide a good example for the ones we have to create.
    • Hi Ivan saw your question and since I had similar issues I wanted to help if I can.
      The system I am working on is Windows 7 Pro 64bit
      I had 4 instances of corrupted Tasks
      Here's what I did.
      1. Backed up my registry and saved it.
      2. Verified reg was installed (found mine in C:Windows\syswow64\reg
      3. Created a folder in the same directory as reg called SetACL
      4. Downloaded setacl from here
      There are 32 and 64 bit versions and then extract the download.
      5. Copied the 64 bit version (in my case)
      6.pasted it into the new setacl folder.
      7.Rebooted the machine.
      Ok long explanation of steps...but I wanted to make it as easy as possible.
      Te 4 bad tasks I found Ivan were, Vistasp1ceip,TMM,Gatherwiredinfo,Gatherwirelessinfo.
      Vistasp1ceip was found in the Customer experience Improvement Program for example.
      They aren't hard to find if you open the folders in tree view and click on the folders per the directions.
      I am brave so I did ignore one the steps it stated to just try one at a time I had four so I addressed all four. (you should do whatever you're more comfortable with.
      Ok so we have the reg.exe, we have the setacl lets look at the script.
      make a copy of the script you downloaded and save it to the desktop.
      open the file in edit.
      all of the original files are server related so go to the very first one and edit it.
      when finished it should look like this (these are the four tasks we were trying to fix for example.
      CALL :LOOP "Microsoft\Windows\Customer Experience ImprovementProgram\VISTASP1CEIP"
      CALL :LOOP "Microsoft\Windows\MobilePC\TMM"
      CALL :LOOP "Microsoft\Windows\Wireless\GatherWirelessInfo"
      CALL :LOOP "Microsoft\Windows\Wired\GatherWiredInfo"
      all of the other Call :LOOPS were not applicable in the original script so for simplicity sake I just deleted all but the four we were working on.
      saved the file...done.
      Right clicked on script, run as administrator.
      Run the script.
      Worked flawlessly Ivan.
    • Hi Ivan/Robert ... worked like a dream for me, too!
      I just fixed a small typo on one Call:LOOPS ...
      CALL :LOOP "Microsoft\Windows\Customer Experience Improvement Program\VISTASP1CEIP"
      But thanks!  Greg.
  • Awesome script
    1 Posts | Last post August 07, 2015
    • Not a question but just thanks as well as tips for users of this script.
      Upgrade to Windows 10 did not migrate all of my data, and a revert back to Windows 7 corrupted about  50 tasks. (All local program tasks, as well as background Windows tasks).
      My approach was to write the name of each task as the error appeared, then search for that task in "%windir%\System32\Tasks". Make a shortcut of that task ("Send to Desktop"). 
      That shortcuts properties will point directly to the task. (just an easy way of getting the full link).
      From that I was able add a line in your glorious batch file for each task. (Only thing that failed initially was forgetting to remove everything before the word "Microsoft" from the location links...
      "C:\Windows\System32\Tasks\Microsoft\Windows\AppID\TASK NAME"
      "Microsoft\Windows\AppID\TASK NAME"
      Thank you very much!
  • A Tip for Finding Which Tasks Have Errors
    3 Posts | Last post May 03, 2015
    • Great Script! Easily adapted and ran on Windows Vista computer being repaired here.
      Tip: From the command line run "Schtasks.exe > c:\temp\tasklist.txt" to easily generate a complete list of tasks into a text file. From there, it is a simple matter to go through the list looking for "ERROR" to identify which Tasks are having a problem. Using that information, I was able to quickly generate a CALL :LOOP list.
      Hope that is clear as mud!
    • Excellent idea John!
      If I encounter another one of these computers experiencing the problem I will see if I can fully script up extracting the broken tasks using the SCHTASKS.EXE.
      It would be a combination of a FOR loop querying the data using the EXE, and then a registry query to get the full path of the broken scheduled tasks, so it might not work, but if nothing else it is an excellent idea!
    • Dan,
      Fabulous script. Thank you. I just ran into this problem upgrading VISTA in place to Win7 and the update didn't include SP1 or fix KB2305420. Result: 80 broken task scheduler entries. 
      I figured as typing isn't my strong suit I'd start with a list of tasks and remive the ones I don't need for the CALL LOOP sequence. This simple command makes a good starting point...
      Dir /s/b/A-d C:\Windows\System32\Tasks\ >c:\users\stef\desktop\taskname.txt
      Thanks for the hint. I found no ERROR indications in the Scheduler list but comparing the list with one from a healthy Win7 system I note a lot of N/A in the STATUS column for the broken entries.
      Thank you both.
  • Thank You! (and minor suggestion)
    2 Posts | Last post April 14, 2014
    • This tool saved my bacon! 
      I was screwing with permissions on the Task folders on Windows 7 trying to harden Limited user accounts and suddenly the SystemRestore task entry became corrupted, but I had stupidly turned off system restore itself so had no restore points to go back in time. 
      Your instructions were excellent and your tool worked like a charm, which was a good thing because I would otherwise have had to reinstall the OS from scratch and repeat another 3 hours of VAR work I had done on this brand new system for a client.
      One suggestion: put a PAUSE statement followed by an EXIT 0 statement at the end of the script. I ran this tool by right-clicking to "Run as Administrator" and the messages went flying by and the window disappeared. I routinely end all of my tools this way to give the user a chance to analyze the output.
    • I am very glad this script helped you out, and than you for the rating.
      I like your idea on the PAUSE and EXIT at the end, I will try to get some time and modify it in the not too distant future.
  • Path to SetACL.exe
    3 Posts | Last post January 14, 2014
    • You mentioned "SetACL.EXE must be installed on the server running this batch file. If it isn't already in the PATH, then update the script to reflect its correct location." 
      Please what do you mean by the statement above? 
      Do you mean to add an entry to PATH environment variable or path to the script itself.
      I added an entry to path environment variable but the script could not recreate the task. The error is There was a problem copying the scheduled task file for [my corrupt taskname], skipping this task.
    • In this case the PATH means the system %PATH% variable, and is a list of folders Windows knows to search for things if it can't find them in the local directory.
      You should be able to put the EXE in the same folder you are running the batch file out of.
      The part of the script that generates that warning is with this command:
      ECHO F | XCOPY "%SYSTEMDRIVE%\Windows\System32\Tasks\%TASKNAME:~1,-1%" "%TEMP%\Tasks\%TASKNAME:~1,-1%">Nul 
      This command is copying the task name file to the TEMP folder on your computer. Do me a favor and confirm that you get the contents of a real folder path when you run the following two commands:
      DIR %SYSTEMDRIVE%\Windows\System32\Tasks
      DIR %TEMP%
      If you get "File Not Found" then I believe this is because you have User Account Control turned on and are not running the Command Prompt as an Admin. This is step #3 in the list of steps and is accomplished by holding down your SHIFT key, right mouse clicking the Command Prompt icon in your Start menu, and selecting Run as an Administrator.
    • Thank you for the rating. I will take that as confirmation that running the command prompt as an administrator resolved your issue.
  • Unable to find
    2 Posts | Last post January 12, 2014
    • I have Windows 7: Home Premium and this problem is driving me crazy. I downloaded SetACL and put that .exe in the Windows/System32 folder along with this script (it already had reg.exe).
      When I run this script, I get an error message for each task entry stating "the system is unable to find the specified registry key or value". I haven't changed anything in the script, except for the specifics of each task. As a test, I ran the script with only one of the original tasks included (one that was also faulty on my pc). Still nothing. 
      Any help is greatly appreciated.
    • Did you originally modify the script to only have the CALL :LOOP line for the tasks on your system reporting the error? If you didn't then you will get errors about tasks that I had in the example batch file that aren't on your local Windows desktop.
  • task image is corrupt
    2 Posts | Last post January 06, 2013
    • Apparently in July 2012 you did not have a Win7 machine to try this one. Perchance do you have one now? I'm not sure I can build the script you made reference to in your comment below.
    • I have a Win7 machine, the problem is I don't have a Win7 machine having the issues to recreate a script from. Even if I did though, there is no garuntee that my script would 100% match your computer because you could have different things installed.
      Either way you would want to verify what tasks need to be fixed in the script I posted, removing ones that don't exist on your system and adding the appropriate ones.
      The best I can do is try to assist you with any issues you run into with the process I outlined. I.E. I have provided detailed steps on how to capture the broken tasks and how to list them in the script. If you run into questions/issues/concerns, please let me know and I will try to help.
  • Forum...
    2 Posts | Last post October 16, 2012
    • Posted it there.
    • Thanks for updating the 1 star rating to 3, and sorry the comment about being careful of making registry changes was at the end of the script which made you mad.