This project has moved. For the latest updates, please go here.

COMException: the task has been configured (...)

Aug 8, 2011 at 6:28 PM
Edited Aug 8, 2011 at 6:44 PM

Good evening,

I am trying to set userid for a task:

td.Principal.UserId = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
ts.RootFolder.RegisterTaskDefinition("SataPriceChecker", td);

But I get an exception COMException: the task has been configured with an unsupported combination of account settings and run time options.

Is there a way to solve it under XP?

Regards

Coordinator
Aug 8, 2011 at 11:05 PM

Instead of using Principal.UserId, I would put it all in the RegisterTaskDefinition method with the extra parameters as follows:

ts.RootFolder.RegisterTaskDefinition("SataPriceChecker", td, TaskCreation.Create, "domain\userid", null, TaskLogonType.InteractiveToken);

If you want to do it with the user's password:

ts.RootFolder.RegisterTaskDefinition("SataPriceChecker", td, TaskCreation.Create, "domain\userid", "password", TaskLogonType.Password);
Aug 9, 2011 at 12:27 PM

It is solved. Thanks for the help