You must add the username, password and special TaskLogonType. Like this example:
RegisterTaskDefinition(TaskName.Text, td, TaskCreation.CreateOrUpdate,
RegisterTaskDefinition(TaskName.Text, td, TaskCreation.CreateOrUpdate,
usercred.username, TDES.decryptString(usercred.password),
TaskLogonType.Password);
Bill