This project has moved and is read-only. For the latest updates, please go here.

Behavior between 2003 Server and 2008 Server

Jun 7, 2010 at 11:50 PM
Edited Jun 8, 2010 at 11:36 PM

Under 2003 Server, if you specify the UserID "System" along with "TaskLogonType.ServiceAccount", it will fail with the following error. 


If you leave UserID null, it will create the Task as "NT AUTHORITY\SYSTEM" which is the expected behavior.  I like to have my UserID set to "System" because its going to be needed when the code is run on 2008 Server.  But I am not sure why I am getting this error when running the code under a 2003 Server if "System" is set as the UserID.


ts.RootFolder.RegisterTaskDefinition("Task Name", td, TaskCreation.CreateOrUpdate, "SYSTEM", null, TaskLogonType.ServiceAccount, null);  Fails "System.Runtime.InteropServices.COMException (0x80041314): The task has been configured with an unsupported combination of account settings and run time options. (Exception from HRESULT: 0x80041314"


 ts.RootFolder.RegisterTaskDefinition("Task Name", td, TaskCreation.CreateOrUpdate, null  , null, TaskLogonType.ServiceAccount, null); Succeeds



I would like to know how to install a task so it runs as local system on both 2003 Server and 2008 Server using the same parameters to RegisterTaskDefinition()

Jun 15, 2010 at 6:57 PM

Thanks for the catch. It turns out I had an inconsistency under v1 between the TaskSettings.UserId and TaskFolder.RegisterTaskDefinition property and method. I was checking for "SYSTEM" with the property, but not for the method. This has been corrected in the code drop 52600.