Ok to edit task's xml file in c:\windows\system32\Tasks?

12,707

Solution 1

This is a security feature. A person or malicious program could edit a task file and insert the location to a hostile program. Windows creates a hash of the task file's various attributes and contents, and stores it in the registry. If the stored hash differs from the calculated hash, Windows prevents the task from running.

If you want to do something like this, delete the task and re-create it with the task set to disabled.

Solution 2

Export the original task, then modify the exported XML file. Import into another computer or delete the original task before importing the newly modified task.

Solution 3

To recover, you can always do an Import to import those XML files as new tasks. (might need to rename the file to .xml)

Solution 4

The XML file has a 2 byte prefix consisting of non-ascii characters which cannot be handled by the typical editors (notepad, textpad, ...). When these 2 bytes are destroyed by editing, the file cannot be imported.

Share:
12,707

Related videos on Youtube

Eyad
Author by

Eyad

Updated on September 18, 2022

Comments

  • Eyad
    Eyad over 1 year

    I wrote a PowerShell script that check the executable in the < action > tag for each task in the Task directory and mark the < enabled >TRUEorFALSE< / enabled > tag as false/true depending on the validity of the digital signature of the executable. After reading each task, the script re-saves the task file with the same name, type and location.

    Now my issue is that I get this message when I lunch task scheduler:

    “Task XYZ: The task image is corrupt or has been tampered with.”

    This message appears for all the tasks that were scanned and saved.

    Does editing task’s xml file directly corrupt the task? Is there any task decency that may cause this error(ex: registry value)?

  • Eyad
    Eyad over 11 years
    Do you know can I recover my tasks? I have 10 servers each with 50++ tasks and all of them suffer from the same issue :( I tested my script locally on a test server but I did not notice this error! I have also backed up the Task folder by copy/pasting it into my desktop before I run the script but it seemed that copy/pasting the backup Task folder back to it is original location does not resolve this issue!
  • Greg Askew
    Greg Askew over 11 years
    Sorry, I'm not aware of a method. It may even be the case that after the invalid task is discovered, it would be considered invalid even if restored from a known good copy.
  • 0zkr PM
    0zkr PM about 4 years
    Just it's the BOM char: it's a file enconded in UTF16