question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to connect to Server 2019 to manage tasks

See original GitHub issue

Describe the bug

We have been using this library to manage scheduled tasks and has worked great. Recently with Server 2019 servers getting into the mix, this library can no longer connect.

System.Runtime.InteropServices.COMException (0x80070032): The request is not supported. (Exception from HRESULT: 0x80070032)
   at Microsoft.Win32.TaskScheduler.V2Interop.ITaskService.Connect(Object serverName, Object user, Object domain, Object password)
   at Microsoft.Win32.TaskScheduler.TaskService.Connect()
   at Microsoft.Win32.TaskScheduler.TaskService..ctor(String targetServer, String userName, String accountDomain, String password, Boolean forceV1)
   at TaskSchedulerTestApp.Program.Main(String[] args)

To Reproduce Steps to reproduce the behavior:

  1. Run the following sample console app against a 2019 Server

Expected behavior Should list tasks on the remote server. (Works for 2016 and below but not on 2019)

Environment (please complete the following information):

  • Host Windows version (the one running the code): Windows 10
  • Library version: 2.8.14
  • .Net Framework: 4.7.2
  • Remote Windows version (if applicable): Windows Server 2019 Datacenter v10.0 (17763)

Additional context

Here’s the sample app code:

namespace TaskSchedulerTestApp
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                var server = "my2019server";
                var user = "admin_user";
                var domain = "mydomain";
                var pass = "secret";

                var taskService = new TaskService(server, user, domain, pass);

                Debug.Assert(taskService.Connected, "Not connected");

                foreach (var task in taskService.AllTasks)
                {
                    Console.WriteLine(task.Name);
                }

                Console.WriteLine("Done");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
            Console.ReadLine();
        }
    }
}

Do you know if this is a known case? Or is there a different way to do this now?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:15 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
rasitha1commented, Jul 19, 2019

Thanks! My issue was the Remote Scheduled Tasks Management firewall rule. Once I enabled that I’m now able to connect. (Somehow Troubleshooting tool also didn’t say anything about this).

2reactions
dahallcommented, Jul 19, 2019

So I finally got the server running. I could not use the system tool or the library to connect to the remote WS19 box until I went into the “Allow an app through Windows Firewall” (in Control Panel) and enabled Domain and/or Private access to “Remote Event Log Management” and “Remote Scheduled Tasks Management”.

Once connected however, I did find some incompatibilities when trying to retrieve certain tasks. I’m assuming from past experience that Microsoft has added new undocumented properties to the native COM objects. I will try to get to the bottom of those and will post an update to the library.

However, connecting is not a problem with those two firewall options enabled.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cann't connect to Task Scheduler on a remote Windows ...
Hi, I have tried to manage scheduled tasks on windows server 2019/2022 from my workstations on Windows ... COM' cannot be connected.
Read more >
How to Fix Windows Server 2019 Task Scheduler not Working ...
The first method you can take is to fix the Windows Server 2019 scheduled task not running error by checking and restarting the...
Read more >
Tasks not running properly - Windows Server 2019
1 Answer 1 ... There are a few likely culprits to generate this error. These first three are unlikely if you can access...
Read more >
How do I fix a Win2019 Scheduled Task that fails to launch?
I am able to use a domain admin account to run the task successfully. I have set the task to "Run whether the...
Read more >
Date and Time Unable to Continue You Do Not ... - YouTube
This issue happens with Microsoft Windows Server 2019 when trying to change the ... to Continue You Do Not Have Permission To Perform...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found