Error Scheduling Task on 2008 R2

Sep 7, 2012 at 5:57 PM
Edited Sep 7, 2012 at 5:57 PM

Trying to schedule a task in Global.asax on a 2008 R2 machine.  The task scheduling works fine locally (Win 7), but remotely I get:

[COMException (0x80041318): (42,4):Task:]

System.Runtime.InteropServices.COMException: (42,4):Task:

It seems like this is an error in the XML, but when I import the XML manually in to the Task Scheduler UI it works fine.

Here is the XML:


<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="">
      <Arguments>--job=JobName --params param1="value"</Arguments>


Any thoughts?

Sep 7, 2012 at 8:30 PM

Try removing the '.' from the Author tag. I have seen periods screw things up before.

Sep 7, 2012 at 8:58 PM
Edited Sep 7, 2012 at 8:59 PM

Thanks for the quick response but no luck, just gave that a shot without periods in the Author and still not working.

Sep 7, 2012 at 11:02 PM
Edited Sep 7, 2012 at 11:03 PM

I made some progress when I added a principal block.  I added that block because I tried doing this manually on the machine and exporting and that was the only main difference.

The scheduling is happening in a process running as IIS AppPool\DefaultAppPool right now so not having much luck.  Is the only way to get that to work to change the app pool identity?  Main reason I ask is that this is on an Amazon ElasticBeanstalk machine, so I don't really have the ability to do that unless I start using custom images and I'm trying to avoid that.

Sep 9, 2012 at 7:20 PM
Edited Sep 9, 2012 at 7:22 PM

You can eliminate the Principal block and then use the parameters on the RegisterTaskDefinition method to set those values. The process must have appropriate permissions to connect to the TaskService. There are a number of articles on MSDN that detail what permissions are needed within the host process, when credentials should be provided when connecting to a TaskService instance, and what needs to be done within RegisterTaskDefinition.

Marked as answer by dahall on 4/3/2014 at 11:39 AM