Hi all,
Hope doing well,
sir i am writing a code where i need to disable the particular task in task scheduler.
Here is my code:
string taskName = "Device";
Error is Access is denied Exception from HResult: 0x80070005 (E_AccessDenied)
how to disable it?
Thanks
Hope doing well,
sir i am writing a code where i need to disable the particular task in task scheduler.
Here is my code:
string taskName = "Device";
TaskService ts = new TaskService(@"\\VIKASH", "VICKY", "VIKASH", "securax", true);
using ( ts = new TaskService())
{
Task t = ts.GetTask(taskName);
if (t != null)
{
if (t.Enabled)
{
t.Enabled = false;
t.RegisterChanges();
}
}
}
but getting error in this line " t.Enabled = false;" Error is Access is denied Exception from HResult: 0x80070005 (E_AccessDenied)
how to disable it?
Thanks