I believe something was changed or improved since I made this post - my current code using the newest version of the library looks like this.
currently I simply create the task like this (never supplying a password).
td.Principal.LogonType = TaskLogonType.InteractiveToken;
td.Principal.UserId = "NT AUTHORITY\\SYSTEM";
Later I register the task like this
ts.RootFolder.RegisterTaskDefinition(TaskName, td, TaskCreation.CreateOrUpdate, null, null, TaskLogonType.ServiceAccount, null);