dahall / TaskScheduler

Provides a .NET wrapper for the Windows Task Scheduler. It aggregates the multiple versions, provides an editor and allows for localization.
MIT License
1.21k stars 191 forks source link

Unable to update a task - Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) #855

Closed arsalansaleem96 closed 3 years ago

arsalansaleem96 commented 3 years ago

In windows I have created task scheduler with trigger "At system startup". Now I'm trying to update the taskDefinition using task.RegisterChanges(); It's giving me this exception Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

The scheduler was created using Admin account and I'm using the same account to update the scheduler.

dahall commented 3 years ago

RegisterChanges will fail if the task was created with a password. Is that the case here?

arsalansaleem96 commented 3 years ago

No it's not created with password. I have also posted on stackoverflow.

dahall commented 3 years ago

Have you looked at the examples in the Wiki and in about 20 other closed issues? This is a very common problem with a variety of fixes depending on your environment. I'd start with #782.

arsalansaleem96 commented 3 years ago

Yess I have tried different solutions. I gave all the security permissions . Also, I have tried just assigning the new action to the position of the old one as you mentioned above #782 . Unfortunately, the issue still there.

image

I am getting this exception.

image

You can also see stacktrace.

image

dahall commented 3 years ago

Were you able to work around your issue?