dahall / TaskScheduler

Provides a .NET wrapper for the Windows Task Scheduler. It aggregates the multiple versions, provides an editor and allows for localization.
MIT License
1.2k stars 191 forks source link

TaskService.FindAllTasks does not return tasks in Windows 11 if application is not started in Administrator mode #912

Closed gweerheim closed 2 years ago

gweerheim commented 2 years ago

Describe the bug The call TaskService.FindAllTasks(...) does not return data in Windows 11 if application is not started in Administrator mode. In Windows 10 this works.

To Reproduce

Windows 11:

  1. Call TaskService.FindAllTasks(...) in your application that is not started in Administrator mode. Result: no tasks found.
  2. Call TaskService.FindAllTasks(...) in your application that is started in Administrator mode. Result: tasks found.

Windows 10:

  1. Call TaskService.FindAllTasks(...) in your application that is not started in Administrator mode. Result: tasks found.
  2. Call TaskService.FindAllTasks(...) in your application that is started in Administrator mode. Result: tasks found.

Expected behavior TaskService.FindAllTasks(...) should return tasks in Windows 11 if the application is not started in Administrator mode like in Windows 10.

Environment (please complete the following information):

dahall commented 2 years ago

Unfortunately I don't have a system to test Win11. As you may know, this library simply wraps the native COM interfaces for Windows Task Scheduler. FindAllTasks is implemented with ITaskFolder::GetTasks() method, passing 1 for the first parameter which indicates to retrieve all tasks, including those that are hidden. Before chalking this up as a Microsoft bug, I need to test the results when passing 0 where hidden tasks are excluded to see if that can be done without Admin rights.

Once I'm able to test, I'll either implement a fix or file a bug report with Microsoft.

Gotta love new Windows releases!!

dahall commented 2 years ago

I got onto a Win11 image and tested FindAllTasks with an account without Admin rights. I had no problems. Your build of Win11 does not match mine. I just installed from ISO today and have OS Build 22000.194. If you are running a pre-release, please check once the OS is production bits and then let me know.

gweerheim commented 2 years ago

I have tested this on build 22000.194. It is working properly now!

gweerheim commented 2 years ago

Issue does not occur on the official build 22000.194 of Windows 11.