是否可以从包中启动计划的Windows任务?

时间:2022-08-03 02:32:39

Does anyone know if you can and how to start off a scheduled Windows task on a Remote Server from within a SQL Server Integration Services (SSIS) package?

有谁知道你是否可以以及如何从SQL Server Integration Services(SSIS)包中的远程服务器上启动计划的Windows任务?

3 个解决方案

#1


2  

Assuming you run it on Windows Server 2003/2008 or Vista, use SSIS Execute Process Task to start SCHTASKS.EXE with appropriate params (SCHTASKS /Run /? to see details).

假设您在Windows Server 2003/2008或Vista上运行它,请使用SSIS执行进程任务以适当的参数启动SCHTASKS.EXE(SCHTASKS / Run /?以查看详细信息)。

#2


0  

It should be possible as the Task Scheduler has a scriptable COM API that can be used for interacting with tasks.

它应该是可行的,因为任务计划程序具有可用于与任务交互的可编写脚本的COM API。

You could therefore either create a custom task that uses COM interop to call the Task Scheduler API, or it'd probably be quicker to use an Active X Script task to do your dirty work.

因此,您可以创建一个使用COM互操作来调用Task Scheduler API的自定义任务,或者使用Active X Script任务来执行您的脏工作可能会更快。

#3


0  

I invested a lot of time in the aforementioned COM API back in 2002. It was, to put it mildly, "flakey".

我在2002年的上述COM API中投入了大量时间。温和地说,它是“flakey”。

What we ended up doing instead is having our tasks run every minute. The first thing the task did was check the database to see if it should continue running or not.

我们最终做的是让我们的任务每分钟运行一次。该任务所做的第一件事是检查数据库以查看它是否应该继续运行。

Then "starting" a scheduled task from SSIS was as simple as changing a database field.

然后从SSIS“启动”计划任务就像更改数据库字段一样简单。

#1


2  

Assuming you run it on Windows Server 2003/2008 or Vista, use SSIS Execute Process Task to start SCHTASKS.EXE with appropriate params (SCHTASKS /Run /? to see details).

假设您在Windows Server 2003/2008或Vista上运行它,请使用SSIS执行进程任务以适当的参数启动SCHTASKS.EXE(SCHTASKS / Run /?以查看详细信息)。

#2


0  

It should be possible as the Task Scheduler has a scriptable COM API that can be used for interacting with tasks.

它应该是可行的,因为任务计划程序具有可用于与任务交互的可编写脚本的COM API。

You could therefore either create a custom task that uses COM interop to call the Task Scheduler API, or it'd probably be quicker to use an Active X Script task to do your dirty work.

因此,您可以创建一个使用COM互操作来调用Task Scheduler API的自定义任务,或者使用Active X Script任务来执行您的脏工作可能会更快。

#3


0  

I invested a lot of time in the aforementioned COM API back in 2002. It was, to put it mildly, "flakey".

我在2002年的上述COM API中投入了大量时间。温和地说,它是“flakey”。

What we ended up doing instead is having our tasks run every minute. The first thing the task did was check the database to see if it should continue running or not.

我们最终做的是让我们的任务每分钟运行一次。该任务所做的第一件事是检查数据库以查看它是否应该继续运行。

Then "starting" a scheduled task from SSIS was as simple as changing a database field.

然后从SSIS“启动”计划任务就像更改数据库字段一样简单。