简体   繁体   English

TaskScheduler从工作组计算机访问任务

[英]TaskScheduler to access task from a Workgroup machine

I am using the Win32.TaskScheduler to run Windows Scheduled Tasks from my web application as mentioned in this thread. 我正在使用Win32.TaskScheduler从我的Web应用程序运行Windows计划的任务,如该线程中所述。

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 (因为我的电脑->属性显示类似Workgroup的内容:WORKGROUP ),并且我的Web应用程序在此行中引发错误

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

So if the machine is in a WorkGroup, this task scheduler will not work? 因此,如果计算机在工作组中,则此任务计划程序将无法工作?

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. 在这种情况下,您将使用COMPUTERNAME / USERNAME而不是DOMAIN / USERNAME。 Therefore I would guess you have to use your computer name. 因此,我想您必须使用您的计算机名称。

Include a reference to interop.taskscheduler.dll, and then in your code: 包括对interop.taskscheduler.dll的引用,然后在您的代码中:

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)
{
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM