views:

752

answers:

3

Hello,

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?

Cheers

Nigel

A: 

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

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.

Ubiguchi
A: 

I invested a lot of time in the aforementioned COM API back in 2002. It was, to put it mildly, "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.

Portman
+3  A: 

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).

Michael