title: TaskService not working
body: <p>I'm trying to write some code that uns the task on my local workstation after a certain period of time but at the moment I'm having problems getting the work to be done.</p>
  
  <p>Below is the code I am running.</p>
  
  <pre><code>using System;
  using Microsoft.Win32.TaskScheduler;
  
  namespace TaskSchedularExamplw
  {
      class Program
      {
          static void Main(string[] args)
          {
              Console.WriteLine("Task Started");
              using (TaskService ts = new TaskService())
              {
                  TaskDefinition t = ts.NewTask();
                  t.Triggers.Add(new TimeTrigger() { StartBoundary = DateTime.Now, Enabled = true });
                  t.Principal.LogonType = TaskLogonType.InteractiveToken;
                  TimeTrigger tt = (TimeTrigger)t.Triggers.Add(new TimeTrigger() { StartBoundary = DateTime.Now, Enabled = true });
                  tt.Repetition.Duration = TimeSpan.FromHours(1);
                  tt.Repetition.Interval = TimeSpan.FromMinutes(1);
                  t.Actions.Add(new ExecAction(@"C:\Program Files (x86)\Notepad++\notepad++.exe", "c:\\test.txt", null));
                  const string taskName = "Test";
                  ts.RootFolder.RegisterTaskDefinition(taskName, t);
                  var runningTasks=ts.GetRunningTasks();
              }
  
              Console.ReadLine();
          }
      }
  }
  </code></pre>
  
  <p>Can someone please tell me what exactly is I am doing wrong here.</p>