Task schdule to server using Microsoft.Win32.TaskScheduler

AnilkumarM 41 Reputation points
2021-04-09T09:22:30.903+00:00

Can I make a Task scheduling in a server from the user computer programmatically using Microsoft.Win32.TaskScheduler ?

TaskService ts = new TaskService();
                    TaskDefinition td = ts.NewTask();
                    td.RegistrationInfo.Description = NameOfTask;
                    td.Triggers.Add(new TimeTrigger { StartBoundary = FinalRunTime, Enabled = true });
td.Actions.Add(new ExecAction("CreateMTO.exe", null, null));
ts.RootFolder.RegisterTaskDefinition(NameOfTask, td);
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,279 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Castorix31 86,966 Reputation points
    2021-04-09T09:27:49.273+00:00

    Did you try with TaskService.Connect ?


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.