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

New Post: Scheduled task not running in Windows 10 creators update

$
0
0
I'm doing some tests with the following code which creates a task to run Notepad after 2 minutes. It works on Windows 8.1 and Windows 10 but with Windows 10 Creators update the task does not run. It just moves on to the next date and if task history is turned on nothing is recorded in the history.
        using (TaskService ts = new TaskService())
        {
            string name = "AJC test " + Guid.NewGuid();

            // Create a new task definition and assign properties
            TaskDefinition td = ts.NewTask();
            td.RegistrationInfo.Description = name;

            // Create a trigger that will fire the task in 2 minutes time
            Trigger Trigger = new DailyTrigger();

            Trigger.StartBoundary = DateTime.Now.AddMinutes(2);

            td.Triggers.Add(Trigger);

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

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

Viewing all articles
Browse latest Browse all 2206

Trending Articles



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