Q:

Using the Microsoft.Win32.TaskScheduler DLL For Windows Server 2016

I have used the Microsoft.Win32.TaskScheduler DLL to list, display, and start Tasks in C# from the Task Scheduler on my Windows Server 2008 for years.  I am upgrading the server to Windows Server 2016 and have encountered an issue when using this DLL.  When trying to get the Tasks on the server using this code:
List<TaskObject> tasks = new List<TaskObject>();
using (TaskService ts = new TaskService(servername))
{
     tasks = ts.RootFolder.AllTasks.Where(x => x.Definition.Principal.UserId != null)
             .Select(x => new TaskObject(x, servername)).ToList();
}

I get the following error:
The current version of the native library (1.1) does not support the original or minimum version of the "EDP Policy Manager" task
I did some research and it looks like the Microsoft.Win32.TaskScheduler DLL was built for Windows Server 2008 and Windows Server 2003.  Does anyone know if there is an updated DLL available or a fix? Ultimately if there is not a solution regarding the Microsoft.Win32.TaskScheduler DLL, would anyone know of any similar DLL replacements that I should look into using?

A:

According to TaskScheduler official GitHub repo 

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).

So, the maximum supported version is 1.4. It seems, that you should update the used version of this dll to the latest one from Nuget.
Don't be confused by package or repository name, there is Microsoft.Win32.TaskScheduler.dll inside the package

