启动远程计划任务 [英] Starting a remote scheduled task
本文介绍了启动远程计划任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用c#启动不在本地存储但在网络上另一台计算机上的计划任务?
How is it possible to start a scheduled task that is not locally stored but on another computer on your network, using c#?
似乎我无法确定计划任务的路径。
另外,我只需要启动任务。我不需要等待它完成,也不需要任何错误处理。只需运行任务即可。
It seems that i cannot determine the path of the schedule task. Also I just need to start the task. I dont need to wait for it to finish and I do not need any error handling. Just run the task.
推荐答案
安装NuGet软件包:任务计划程序托管包装器
,然后您可以使用:
Install NuGet package: Task Scheduler Managed Wrapper and then you can use:
using Microsoft.Win32.TaskScheduler;
using (TaskService tasksrvc = new TaskService(server.Name, login, domain, password))
{
Task task = tasksrvc.FindTask(taskName);
task .Run();
}
这篇关于启动远程计划任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文