是否可以从asp.net-mvc网站或其他远程选项管理Windows Scheduler? [英] Is it possible to manage windows scheduler from an asp.net-mvc site or other remote options?

查看:105
本文介绍了是否可以从asp.net-mvc网站或其他远程选项管理Windows Scheduler?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图查看是否可以从asp.net-mvc网站管理一堆Windows计划的任务(设置新任务,更新现有任务的频率等),因为我们希望允许非技术用户进行更新此信息(因此,我们希望避免人们不必直接登录Web服务器,等等)

I am trying to see if I can manage a bunch of windows scheduled tasks from an asp.net-mvc site (setting up new tasks, updating frequency of existing tasks, etc) because we want to allow non technical users to update this info (so we want to avoid people having to log into the webserver directly,etc)

我看到您可以从C#总体上执行此操作(下面的链接),但不确定权限,等等,因此可以通过Web应用程序进行管理.

I see you can do this from C# in general (links below) but not sure about entitlements, etc that would make it possible to manage via web app.

  • http://code.msdn.microsoft.com/windowsdesktop/CSTaskScheduler-2f70d723
  • Creating Scheduled Tasks

如果无法从网络上获得,是否还有其他远程"选项,以便人们无需进入特定框就可以执行此操作?

If its not possible from the web, are there other "remote" options so folks can do this without going in to specific box?

推荐答案

是的,只需使用可以在C:\ Windows \ SysWOW64 \中找到的taskchd.dll. 只需将其引用到您的网络应用即可,并像这样使用它

Yes you can, just use the taskschd.dll which can be found in C:\Windows\SysWOW64\ Just reference that to your web app and use it like this

using TaskScheduler;

namespace Test
{
    public class Class1
    {
        public void Test()
        {
            var taskService = new TaskScheduler.TaskScheduler();
            taskService.Connect();

            var rootFolder = taskService.GetFolder(@"\");

            var registeredTasks = rootFolder.GetTasks(0);
            foreach (var registeredTask in registeredTasks)
            {

            }
        }
    }
}

要在此处向您证明其运行,是从网页调用的运行代码的屏幕截图

To prove to you its running here is screenshot of the running code called from a webpage

从我的机器上可以看到,我从任务计划程序中抓取了5个项目.

As you can see from my machine I grabbed 5 items from my task scheduler.

顺便说一句,我在您的博客中为您创建了整篇文章,内容涉及:

  1. 获取所有计划任务
  2. 创建/更新预定任务
  3. 删除预定任务

在此处 http://macaalay.com/2013/10/02/计划任务的程序管理/

这篇关于是否可以从asp.net-mvc网站或其他远程选项管理Windows Scheduler?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆