Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Starting a remote scheduled task

How is it possible to start a scheduled task that is not locally stored but on another computer on your network, using c#?

It seems that i cannot determine the path of the schedule task. Also I just need to start the task. I dont need to wait for it to finish and I do not need any error handling. Just run the task.

like image 351
jayt.dev Avatar asked Oct 08 '13 09:10

jayt.dev


People also ask

How do I start a scheduled task service?

Open Task Scheduler (Start > in search type Task Scheduler and select when found). Once Task Scheduler opens, in the right column window click on Create Task... In the General tab, type a name for the service. Enable the "Run whether user is logged on or not" and "Run with highest privileges".


1 Answers

Install NuGet package: Task Scheduler Managed Wrapper and then you can use:

using Microsoft.Win32.TaskScheduler;

using (TaskService tasksrvc = new TaskService(server.Name, login, domain, password))
{
    Task task = tasksrvc.FindTask(taskName);
    task .Run();       
}
like image 166
C4stor Avatar answered Oct 13 '22 23:10

C4stor