title: Task scheduler trigger when system boot in C#
body: <p>I have created a task scheduler and set its trigger time fixed e.g. daily-5:00 pm, but I want to trigger that event when system start or boot. Please help me with code if you have any example.</p>
  
  <p>Thanks in Advance. </p>
  
  <p>Code :------------------------------------------------------</p>
  
  <pre><code> public static void CreateTask()
          {
              using (TaskService task = new TaskService())
              {`enter code here`
                  TaskDefinition taskdDef = task.NewTask();
  
                  taskdDef.RegistrationInfo.Description = "Does something";
                  taskdDef.RegistrationInfo.Documentation = "http://www.mysite.com";
  
                  taskdDef.Settings.ExecutionTimeLimit = new TimeSpan(0, 10, 0);
                  taskdDef.Settings.AllowDemandStart = true;
  
                  taskdDef.Actions.Add(new ExecAction(@"D:\Myfolder\bin\SGSclient.exe", "yourArguments", null));
                  task.RootFolder.RegisterTaskDefinition("YourTask", taskdDef);
              }
          }
  </code></pre>