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.21k stars 191 forks source link

Connecting Remote Machine using Task service. #867

Closed mscsesaamy closed 3 years ago

mscsesaamy commented 3 years ago

In the Azure virtual machine, there are several jobs scheduled we tried to access those jobs from my system it is throwing an error as below. System.Runtime.InteropServices.COMException: 'The request is not supported. (Exception from HRESULT: 0x80070032)'

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)

dahall commented 3 years ago

As you may conclude from the Exception, the error is being thrown by the underlying COM object ITaskService during the Connect method. If you look at the help for ERROR_NOT_SUPPORTED, you'll see a possible cause. This error does show up at times when trying to connect to older systems. Unfortunately, this is likely a Microsoft problem and not a problem for this library, which is just a wrapper for the complex COM API for Windows Task Scheduler.

mscsesaamy commented 3 years ago

The following is working fine in a domain environment TaskService ts = new TaskService("COMPUTERNAME", "remoteUserAcctName", "DOMAINNAME", "remoteUserPassword");

But I tried using the same on my PC it is not working.

dahall commented 3 years ago

Most often when this method works in one environment, but not another, there is a permissions problem. Please see the project Wiki for information about how to test the security settings and correct them.