Attempting to disable a task results in COMException. #945
-
I used a program written with this library to create a task (and it works). However, now I want to use a different program written with this library to disable (or delete) that same task. However, I'm getting a "System.Runtime.InteropServices.COMException (0x80070534): (11, 38). Between then and now, I have renamed my machine, but there has only ever been one user and the username hasn't changed. Disable code: If I try to delete the task, then I get an UnauthorizedAccessException. Maybe I'm using the library wrong. Any help would be appreciated. Thanks for listening. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
That error is ERROR_NONE_MAPPED: No mapping between account names and security IDs was done. See this TechNet article for some insight. Are you able to view and edit the task in the Task Manager UI? (system app) To disable a task you can simply write Your exception on deletion is likely due to not running the code in Administrator mode. |
Beta Was this translation helpful? Give feedback.
That error is ERROR_NONE_MAPPED: No mapping between account names and security IDs was done. See this TechNet article for some insight.
Are you able to view and edit the task in the Task Manager UI? (system app)
To disable a task you can simply write
TaskService.Instance.GetTask(taskName).Enabled = false;
Maybe this won't throw an exception.Your exception on deletion is likely due to not running the code in Administrator mode.