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

Change Password for Task

Dec 21, 2011 at 9:13 AM
Edited Dec 21, 2011 at 9:15 AM

hello,

i'm running my tasks under domain accounts,

how can i change the password for an existing task? i don't want to create new task and get the old one definition(replace).

 

 

Best,

 

Coordinator
Dec 21, 2011 at 8:03 PM

I believe the following will work:

using (TaskService ts = new TaskService())
{
   // Get an instance of the task
   Task t = ts.GetTask(taskName);
   // Get the task's definition
   var td = t.Definition;
   // Register the task using new credentials
   ts.RootFolder.RegisterTaskDefinition(taskName, td, TaskCreation.CreateOrUpdate, newUserName, newUserPassword, TaskLogonType.Password);
}