Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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)?

share|improve this question

2 Answers 2

up vote 0 down vote accepted

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.

share|improve this answer
    
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! –  Eyad Oct 20 '12 at 16:35
    
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. –  Greg Askew Oct 20 '12 at 17:44

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.