0

I am using the Win32.TaskScheduler to run Windows Scheduled Tasks from my web application as mentioned in this thread.

Now the difficulty I am facing is the machine which has the tasks scheduled is not in a network domain. (Since My Computer -> Properties shows something like Workgroup : WORKGROUP) and my web application is throwing an error in this line

TaskService tasksrvc = new TaskService(server.Name, login, domain, password);

So if the machine is in a WorkGroup, this task scheduler will not work?

Community
  • 1
  • 1
Vishnu Y
  • 2,211
  • 4
  • 25
  • 38
  • You may want to take a look at the [Revalee](http://revalee.sageanalytic.com/) open source project. The project was designed specifically for scheduling tasks for web applications and includes async processing. NuGet packages exist for both [ASP.NET](http://www.nuget.org/packages/Revalee.Client/) and [ASP.NET MVC](http://www.nuget.org/packages/Revalee.Client.Mvc/) projects. The source code is on [GitHub](https://github.com/SageAnalytic/Revalee/). – László Koller May 07 '14 at 12:54

2 Answers2

0

I haven't used it, but I would guess it will work.

Provide your computer name (not workgroup name) where it says domain.

Your users are local. In such a case you would use COMPUTERNAME/USERNAME instead of DOMAIN/USERNAME. Therefore I would guess you have to use your computer name.

Thor
  • 291
  • 2
  • 8
  • I tried this but I am getting a "Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))" error. – Vishnu Y May 06 '14 at 08:33
  • I guess this is a good thing :). I would suspect an other error msg if the user was not found. Maybe it has something to do with the users privileges. Has the user full access to the pc resources and services? – Thor May 06 '14 at 08:53
  • I tried with the Administrator account so that access restrictions wont be there. Plus the Remote Scheduled Task Management is enabled in Windows Firewall, Still its throwing the above error. Any thoughts? – Vishnu Y May 06 '14 at 10:30
  • Hmm.... not really at this point. I would suggest creating a small console app and try to run that on the machine with the scheduler. This way you eliminate all connection issues. This way you know if you have to look at the connection issues or local execution issues. – Thor May 06 '14 at 10:46
0

Include a reference to interop.taskscheduler.dll, and then in your code:

TaskScheduler.TaskScheduler ts = new TaskScheduler.TaskScheduler();
ts.Connect(ipaddress, "Administrator", ipaddress, "Password123");
TaskScheduler.ITaskFolder rootFolder = ts.GetFolder(@"\");
TaskScheduler.IRegisteredTaskCollection tasks = rootFolder.GetTasks(0);

foreach (TaskScheduler.IRegisteredTask rt in tasks)
{
}
Adey
  • 1