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

Commented Unassigned: RegisterTask fails on windows 10 (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED) [12466]

$
0
0
I am running the example given on https://taskscheduler.codeplex.com/ on my localPC.
__CODE:__
using (TaskService ts = new TaskService())
{
// Create a new task definition and assign properties
TaskDefinition td = ts.NewTask();
td.RegistrationInfo.Description = "Does something";

// Create a trigger that will fire the task at this time every other day
td.Triggers.Add(new DailyTrigger { DaysInterval = 2 });

// Create an action that will launch Notepad whenever the trigger fires
td.Actions.Add(new ExecAction("notepad.exe", "c:\\test.log", null));

// Register the task in the root folder
ts.RootFolder.RegisterTaskDefinition(@"Test", td);
}

I see this Behaviour:
* This fails on Windows 10 PC.
* This works on WIndows 7 PC.
* This works on Windows 10 PC if I start the application as "Run as administrator"


Error Details:__
__Microsoft.Win32.TaskScheduler - Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))__
at Microsoft.Win32.TaskScheduler.V2Interop.ITaskFolder.RegisterTaskDefinition
at Microsoft.Win32.TaskScheduler.TaskFolder.RegisterTaskDefinition
at Microsoft.Win32.TaskScheduler.TaskFolder.RegisterTaskDefinition

__I want to run the application without using "Run as Administrator" on windows 10. Can you suggest a fix.__
__
Comments: ** Comment from web user: dahall **

Let's try this: I have uploaded a zip file with a small app that can run small code snippets against the Task Scheduler library (TestTaskLibConsole.zip). On an offending system, extract the files to a folder and then run TestTaskLibConsole.exe in the same account as your prior tests withing running the application as Administrator. Also in the zip file is a file "testcode.cs" that contains the snippet you have reported as failing. You can open this file from the console program or paste its contents into the console window and then click the Run button. If it fails, please send me a snapshot of the window.

I have tried this snippet in the console on Win 10 (1703 & 1607) and Server 2016 (1607) without any failures. I am running in a domain account that is a member of the local machine's Administrators group. In the zip file is a "capture.png" image that has a clip of the output from Win 10.

Hopefully this will help us narrow your problem.


Viewing all articles
Browse latest Browse all 2206

Trending Articles



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