I have created and registered a task as below
ts.RootFolder.RegisterTaskDefinition(
taskname,
td,
TaskCreation.CreateOrUpdate,
ConfigurationManager.AppSettings["UserName"],
ConfigurationManager.AppSettings["Password"],
TaskLogonType.InteractiveTokenOrPassword);
The problem is that when the task is executed from the task manager it keeps bringing a black "Taskeng.exe" window which opens up and closes automatically.