Saturday, January 16, 2010

Executing an SSIS package through command line utility and power shell

Using Dtexec command line utility
Open command prompt and use following command to execute the package. Set the value of variable Mode as Dtexec as shown below and execute the command.

Verify the result in the table. There is lot of switches used in the above command and the tricky part here is that all this can be generated without writing even a single line inside the command prompt. Open the Execute package Utility using dtexecUI (as we have seen earlier in executing the package using DtExecUI). After selecting the package source and package name, set the variable’s value as Dtexec. Then click on Command Line tab and copy the command and paste it in command prompt after typing DTEXEC. The command that is to be copied from DtExecUI is shown below:

Using Windows Powershell
Windows powershell can also be used to execute the package in same way we executed the package using command line utility with a very small difference. Open windows powershell and use same command which was used in dtexec command line utility and execute as shown below:

In the above figure there is a message “option set is invalid” and the package does not gets executed (can be verified by checking the result in the table). The only small difference between the commands used in command prompt and powershell is double quote (“) after [User::Mode] as shown in red circle below:

Remove this double quote and add a double quote after the variable value powershell as shown below:
Check the result in the table. A new row with Execution Mode as Powershell is present in the table now.


No comments:

Post a Comment