Another voice on the subject.
I wrote a comment on a Microsoft documentation site about this problem. The reply is below:
---------------------
Thanks for the background information. You might also want to try setting the priority of the task. I don't think this can be done through the Task Scheduler UI, but if you modify the xml for the task (probably the easiest option), or if you create it programmatically, then you can set the priority (
http://msdn.microsoft.com/en-us/library/aa381855(VS.85).aspx). I haven't tried this myself, but by setting the priority to something like 4 (an interactive task), then my hope would be that the running task process would keep the computer from sleeping.
If you want to modify the task XML to set the priority, first export the task to an xml file, and then in the XML under the <Settings> element, you can specify a <Priority> element with a value.
Let me know if you need any help with changing the priority and I can help provide an example.
Chris
----------------------------------------
This, of course, does not SOLVE the overall problem - just (possibly) another way.