Can't save changes or login with credentials

38 views
Skip to first unread message

appli...@gmail.com

unread,
Nov 13, 2019, 9:40:13 AM11/13/19
to Task Scheduler Managed Wrapper
Hello,

I'm discovering Task Scheduler as I need a way to manage the tasks of my server with a C# Web Application

I can display the tasks but when I try to save changes, I encouter an exception.

Here's an extract of my code

TaskService ts = new TaskService();
Task task = ts.GetTask("foobar");
task
.Definition.RegistrationInfo.Description = "hey";
task
.RegisterChanges();

And the exception when trying calling RegisterChanges();

Exception de HRESULT : 0x80070005 (E_ACCESSDENIED)


I first thought that it was due to credentials as I don't specify my username or password. So I tried this

TaskService ts = new TaskService(targetServer:"127.0.0.1",userName:"AzureAD\\xxx",accountDomain:"DESKTOP-xxx",password:"xxxxx");

My comptuter is not in a domain but a workgroup so I put the name of my computer instead. I tried multiple times with differents combinations (name, domain etc.) without success : Exception de HRESULT : 0x80070005 (E_ACCESSDENIED))

Any clue on what I'm doing wrong ?

Thanks !

Jean-François

daha...@gmail.com

unread,
Jan 30, 2020, 1:54:55 PM1/30/20
to Task Scheduler Managed Wrapper
Sorry for missing this. If you are still experiencing problems, maybe this explanation will help:

Let me know if you are still having problems after reading that.

daha...@gmail.com

unread,
Jan 31, 2020, 6:24:35 PM1/31/20
to Task Scheduler Managed Wrapper
Just so others searching will find the resolution, below is the copied email thread from :

well, first, thank for reply, and yes i still have that problem on deployment server (Windows Server 2016 standard)

i can figure out which permission I need to add to SYSTEM account - since all works on my development pc (on deployment server, it creates Folder, but cant create task  with

 ts.RegisterTaskDefinition("some service", TaskCreation.Create, "SYSTEM", null, TaskLogonType.ServiceAccount);

i know that i can create another user just for this purpose, but i wanted to keep it with SYSTEM account or get some info how to create user JUST for this purpose, but looking for general solution which will work everywhere

do you maybe have ANY idea|?

Later:

after few hours of examination i solved it

added DefaultAppPool user to backupgroup operators

thank you for all effort!!! 

Reply all
Reply to author
Forward
0 new messages