How do I run cmd.exe to execute DTExec using Task Scheduler?

I am trying to automate an SSIS package using dtexec

Task Scheduler (since I do not have permission to create it via SQL Agent) and it needs to be done locally on my machine. I am referring to this post: How do I run cmd.exe to execute a command using Task Scheduler? but I can't seem to get the syntax for dtexec.

My Script Program:

"C:\Program Files\Microsoft SQL Server\120\DTS\Binn\dtexec.exe" 

      

with an added argument:

/f "C:\Users\f9a\Desktop/HRFact.dtsx"

      

enter image description here

But when it starts up, it pops up in the window cmd

for a second and then leaves. History shows return code 4.

enter image description here

I can run this in cmd.exe

by typing this:

dtexec/f "C:\Users\f9a\Desktop/HRFact.dtsx" 

      

and it works great. I just can't seem to get the syntax for the task scheduler. You can help? Thanks in advance!

-Trey

+3
cmd sql-server ssis taskscheduler


source to share


2 answers


Just change the value of the textbox Start In

to

C:\Program Files\Microsoft SQL Server\120\DTS\Binn\

      

And change the value of the textbox Program/Script

to



DtExec

      

useful links

  • https://msdn.microsoft.com/en-us/library/ms162810.aspx
  • How do I schedule an SSIS package job in SQL Scheduler or Windows Scheduler?
  • http://www.microsoft-sql-ssis.com/2015/09/running-ssis-package-from-command.html
  • https://social.msdn.microsoft.com/Forums/sqlserver/en-US/eb800310-bfb4-4caf-ad8e-f3f9c36ff885/running-the-ssis-package-using-the-task-scheduler?forum=sqlintegrationservices
+1


source to share


(This is probably a comment, but a bit long for that. Sorry.)

Your task is working correctly. What you only see the console window comes up quickly because it DTEXEC

launches (it's a console application) but immediately exits with an error.

Return code 4, which is exit code (or ERRORLEVEL

) DTEXEC

, returns when it cannot find the package file (as per this ).



Since the package appears to be in the user's specific directory ( "C:\Users\f9a\Desktop/HRFact.dtsx"

), make sure that the user who runs the task has access to that directory.

(Also for common sense, use a backslash in front of the filename, although that doesn't matter)

+1


source to share







All Articles
Loading...
X
Show
Funny
Dev
Pics