SSIS Script Task to execute a .bat file or a scheduled task on a remote computer

I'm reasonably new to SSIS in SQL 2005 and have limited knowlege of scripting .bat files.  My problem is that we have a scheduled task on a remote server that I need to kick off from a SSIS Script Task and I need to know it completes successfully before I continue to the next steps.  The scheduled task runs successfully on the remote server and I can also successfully run the task from a .bat file on the remote server.  I need help with getting the SSIS package script task  to successfully execute either the remote task or the .bat file

Among other things, I have tried:

 Dim ShellObject = CreateObject("WScript.Shell")
        Dim strCmd As String
        Dim intReturn As Integer

        strCmd = "\\RemoteServerName\e$\Test\FileToRun.bat"

        intReturn = ShellObject.run(strCmd, , True)

        'MsgBox(intReturn)
        If intReturn = 0 Then

            Dts.TaskResult = Dts.Results.Success
        Else
            Dts.TaskResult = Dts.Results.Failure
        End If


Typically I find answers in previous postings from other people, but not this time, so I wonder if I'm even in the right ball park.   Any help, and/or sample code would be very much appreciated!

Thanks,
D.
DataDizzyAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Reza RadConnect With a Mentor Commented:
you can run your .bat file with EXECUTE PROCESS TASK
and now if execute process task runned successfuly or not you can do appropriate work.
0
 
DataDizzyAuthor Commented:
Thank you!    This worked for me.

D.
0
All Courses

From novice to tech pro — start learning today.