TaskScheduler 2.10.0
About
The original and most popular .NET wrapper for the Windows Task Scheduler. It provides functionally complete classes that cover all development aspects related to system tasks.
More information can be found on the project page on GitHub.
Support
Below are links to sites that provide in-depth examples, documentation and discussions. Please go here first with your questions as the community has been active for over a decade.
- Wiki - Sample code, library how-to, troubleshooting, etc.
- API documentation - Class/method/property documentation and examples
- Full Issues Log - Use the search box to see if your question may already be answered.
- Discussion Forum - Users helping users, enhancement requests, Q&A (retired Google forum here)
- Troubleshooting Tool - Tool to help identify and fix configuration and connectivity issues. (ClickOnce installer here)
Key Features
Microsoft introduced version 2.0 (internally version 1.2) with a completely new object model with Windows Vista. The managed assembly closely resembles the new object model but allows the 1.0 (internally version 1.1) COM objects to be manipulated. It will automatically choose the most recent version of the library found on the host system (up through 1.4). Core features include:
- Separate, functionally identical, libraries for .NET 2.0, 3.5, 4.0, 4.52, 5.0, 6.0, .NET Standard 2.0, .NET Core 2.0, 2.1, 3.0, 3.1.
- Unlike the base COM libraries, this wrapper accommodates creating and viewing tasks up and down stream.
- Supports all V2 native properties, even under V1 tasks.
- Maintain EmailAction and ShowMessageAction using PowerShell scripts for systems after Win8 where these actions have been deprecated.
- Supports all action types (not just ExecAction) on V1 systems (XP/WS2003) and earlier (if PowerShell is installed).
- Supports multiple actions on V1 systems (XP/WS2003). Native library only supports a single action.
- Supports serialization to XML for both 1.0 and 2.0 tasks (base library only supports 2.0)
- Supports task validation for targeted version.
- Supports secure task reading and maintenance.
- Fluent methods for task creation.
- Cron syntax for trigger creation.
The currently supported localizations include: English, Spanish, Italian, French, Chinese (Simplified), German, Polish and Russian.
Usage
You can perform several actions in a single line of code:
// Run a program every day on the local machine
TaskService.Instance.AddTask("Test", QuickTriggerType.Daily, "myprogram.exe", "-a arg");
// Run a custom COM handler on the last day of every month
TaskService.Instance.AddTask("Test", new MonthlyTrigger { RunOnLastDayOfMonth = true },
new ComHandlerAction(new Guid("{CE7D4428-8A77-4c5d-8A13-5CAB5D1EC734}")));
For many more options, use the library classes to build a complex task. Below is a brief example of how to use the library from C#.
using System;
using Microsoft.Win32.TaskScheduler;
class Program
{
static void Main()
{
// Get the service on the remote machine
using (TaskService ts = new TaskService(@"\\RemoteServer", "username", "domain", "password"))
{
// Create a new task definition and assign properties
TaskDefinition td = ts.NewTask();
td.RegistrationInfo.Description = "Does something";
// Create a trigger that will fire the task at this time every other day
td.Triggers.Add(new DailyTrigger { DaysInterval = 2 });
// Create an action that will launch Notepad whenever the trigger fires
td.Actions.Add(new ExecAction("notepad.exe", "c:\\test.log", null));
// Register the task in the root folder.
// (Use the username here to ensure remote registration works.)
ts.RootFolder.RegisterTaskDefinition(@"Test", td, TaskCreation.CreateOrUpdate, "username");
}
}
}
For extended examples on how to the use the library, look at the Examples Page.
No packages depend on TaskScheduler.
.NET Framework 2.0
- No dependencies.
.NET Standard 2.0
- System.Xml.XmlSerializer (>= 4.3.0)
- System.Security.Principal.Windows (>= 5.0.0)
- System.Security.Permissions (>= 5.0.0)
- System.Security.AccessControl (>= 5.0.0)
- System.Runtime.Serialization.Formatters (>= 4.3.0)
- System.Reflection (>= 4.3.0)
- System.Diagnostics.EventLog (>= 5.0.0)
- Microsoft.Win32.Registry (>= 5.0.0)
.NET 6.0
- System.Security.AccessControl (>= 5.0.0)
- Microsoft.Win32.Registry (>= 5.0.0)
- System.Diagnostics.EventLog (>= 5.0.0)
.NET 5.0
- System.Security.AccessControl (>= 5.0.0)
- System.Diagnostics.EventLog (>= 5.0.0)
- Microsoft.Win32.Registry (>= 5.0.0)
.NET Core 3.1
- System.Security.AccessControl (>= 5.0.0)
- Microsoft.Win32.Registry (>= 5.0.0)
- System.Diagnostics.EventLog (>= 5.0.0)
.NET Framework 3.5
- No dependencies.
.NET Framework 4.5.2
- No dependencies.
.NET Core 2.0
- Microsoft.Win32.Registry (>= 5.0.0)
- System.Diagnostics.EventLog (>= 5.0.0)
- System.Security.AccessControl (>= 5.0.0)
.NET Framework 4.0
- No dependencies.
.NET Core 2.1
- System.Diagnostics.EventLog (>= 5.0.0)
- System.Security.AccessControl (>= 5.0.0)
- Microsoft.Win32.Registry (>= 5.0.0)
.NET Core 3.0
- Microsoft.Win32.Registry (>= 5.0.0)
- System.Diagnostics.EventLog (>= 5.0.0)
- System.Security.AccessControl (>= 5.0.0)
Version | Downloads | Last updated |
---|---|---|
2.11.0 | 18 | 06/03/2024 |
2.10.1 | 46 | 04/07/2023 |
2.10.0 | 34 | 05/20/2023 |
2.9.3 | 11 | 06/13/2023 |
2.9.2 | 21 | 06/13/2023 |
2.9.1 | 31 | 04/30/2023 |
2.9.0 | 28 | 04/21/2023 |
2.8.21 | 23 | 04/09/2023 |
2.8.20 | 39 | 04/15/2023 |
2.8.19 | 16 | 04/11/2023 |
2.8.18 | 42 | 04/10/2023 |
2.8.17 | 32 | 04/27/2023 |
2.8.16 | 29 | 04/22/2023 |
2.8.15 | 21 | 05/25/2022 |
2.8.14 | 22 | 04/09/2023 |
2.8.13 | 24 | 07/16/2023 |
2.8.12 | 21 | 04/10/2023 |
2.8.11 | 25 | 05/11/2023 |
2.8.10 | 38 | 05/17/2023 |
2.8.8 | 42 | 04/08/2023 |
2.8.7 | 12 | 06/12/2023 |
2.8.6 | 25 | 04/29/2023 |
2.8.5 | 28 | 04/13/2023 |
2.8.4 | 19 | 04/08/2023 |
2.8.3 | 28 | 04/11/2023 |
2.8.2 | 50 | 04/13/2023 |
2.8.1 | 18 | 06/05/2023 |
2.8.0 | 35 | 04/10/2023 |
2.7.4 | 40 | 04/06/2023 |
2.7.3 | 26 | 04/07/2023 |
2.7.2 | 19 | 04/07/2023 |
2.7.1 | 33 | 04/07/2023 |
2.6.5 | 19 | 04/11/2023 |
2.6.4 | 28 | 04/28/2023 |
2.6.3 | 23 | 04/11/2023 |
2.6.2 | 23 | 04/11/2023 |
2.6.1 | 17 | 04/09/2023 |
2.6.0 | 42 | 04/07/2023 |
2.5.28 | 15 | 02/09/2024 |
2.5.27 | 29 | 04/20/2023 |
2.5.26 | 25 | 05/04/2023 |
2.5.24 | 18 | 04/15/2023 |
2.5.23 | 42 | 04/26/2023 |
2.5.22 | 25 | 10/17/2023 |
2.5.21 | 37 | 04/08/2023 |
2.5.20 | 21 | 04/08/2023 |
2.5.19 | 7 | 02/10/2024 |
2.5.18 | 29 | 05/07/2023 |
2.5.17 | 36 | 04/08/2023 |
2.5.16 | 14 | 02/09/2024 |
2.5.15 | 22 | 04/30/2023 |
2.5.14 | 20 | 04/08/2023 |
2.5.13 | 17 | 07/15/2023 |
2.5.12 | 34 | 04/10/2023 |
2.5.11 | 31 | 04/30/2023 |
2.5.10 | 19 | 06/02/2023 |
2.5.9 | 19 | 04/15/2023 |
2.5.8 | 31 | 04/26/2023 |
2.5.7 | 28 | 04/09/2023 |
2.5.6 | 20 | 04/10/2023 |
2.5.5 | 36 | 04/16/2023 |
2.5.4 | 11 | 06/12/2023 |
2.5.3 | 31 | 04/19/2023 |
2.5.2 | 39 | 04/08/2023 |
2.5.1 | 41 | 04/13/2023 |
2.5.0 | 37 | 04/29/2023 |
2.4.2 | 35 | 04/09/2023 |
2.4.0 | 45 | 04/11/2023 |
2.3.4 | 32 | 04/30/2023 |
2.3.3 | 14 | 04/29/2023 |
2.3.2 | 41 | 04/22/2023 |
2.3.1 | 49 | 04/10/2023 |
2.3.0 | 28 | 04/14/2023 |
2.2.2 | 18 | 04/28/2023 |
2.2.1 | 49 | 04/10/2023 |
2.2.0 | 54 | 04/07/2023 |
2.1.1 | 30 | 06/13/2023 |
2.1.0 | 48 | 04/07/2023 |
2.0.3 | 33 | 04/11/2023 |
2.0.0 | 44 | 04/17/2023 |
1.9.4 | 29 | 04/10/2023 |
1.9.3 | 32 | 04/10/2023 |
1.9.2 | 36 | 04/12/2023 |
1.8.3 | 31 | 04/10/2023 |
1.8.2 | 37 | 04/13/2023 |
1.8.1 | 30 | 04/07/2023 |
1.8.0 | 47 | 04/08/2023 |
1.7.1 | 42 | 05/10/2023 |
1.7.0 | 8 | 06/13/2023 |
1.6.3 | 13 | 04/10/2023 |
1.6.2 | 54 | 04/10/2023 |
1.6.1 | 27 | 04/09/2023 |
1.6.0 | 39 | 04/22/2023 |