Quantcast
Channel: Task Scheduler Managed Wrapper
Viewing all articles
Browse latest Browse all 2206

New Post: COMException: "(37,8):LogonType" when changing user

$
0
0

Hello,
I am using v1.9.0.23355 of TaskScheduler and v1.9.0.23358 of TaskSchedulerEditor. I'm trying to use the TaskEditDialog to modify a task which I have created previously using the following code;

taskFolder.RegisterTaskDefinition(taskName, td);


I pop up the dialog like this;

TaskEditDialog editorForm = new TaskEditDialog();
editorForm.Editable = true;
editorForm.RegisterTaskOnAccept = true;
editorForm.Initialize(task);
editorForm.ShowDialog();
editorForm.BringToFront();

I can modify the task OK, but when I try to change the user who runs the task, say fromMyDomain\UserA to MyDomain\UserB, then I get a COMException with the message "(37,8):LogonType".


I've tried a few permutations of the calls to RegisterTaskDefinition, such as;

taskFolder.RegisterTaskDefinition(taskName, td, TaskCreation.CreateOrUpdate, username, null, TaskLogonType.ServiceAccount, null);
With this, I can change between SYSTEM and NETWORK SERVICE with no problem. If I try to change to a normal user then I get an error, which I kinda expected.

I also tried this;

taskFolder.RegisterTaskDefinition(taskName, td, TaskCreation.CreateOrUpdate, username, null, TaskLogonType.InteractiveToken, null);

This allowed me to change to SYSTEM, but not back to MyDomain\UserA. Same exception again.

I would appreciate any guidance that anyone can give me on how to correctly use the library, and please let me know if there's any other information I can supply which would be useful.


Viewing all articles
Browse latest Browse all 2206

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>