Batch scripting makes everything better! If a tool doesn't have a command line equivalent it probably isn't worth using.

dtutil is the command line utility for SSIS Packages. You can use it to perform any function that would be available through interacting with a package store through Management Studio. Like most command line executables you can get help for it with dtutil /?

Installing packages with it is incredibly simple.

dtutil /Fi "C:\MyPackage.dtsx" /EN SQL;TestPackage;5 /Q /dests 193.0.0.1

The above command will take the package MyPackage.dtsx from C:\ and install it . /EN means we want to encrypt that package and install it to the SQL Server as TestPackage. The 5 on the end of that argument is the encryption level, 5 means use the Server's encryption rather than providing a manual password. /Q specifies quiet mode which means the package will automatically overwrite TestPackage if it already exists. Finally the /dests argument specifies which server we're installing to, without it dtutil will assume you want localhost.

There's much more to dtutil, as Microsoft will be happy to show you.

Also I was talking about batch scripting so here's the sample contents of my Install.bat file:

echo off
dtutil /FC SQL;\;TestProject /sources 193.0.0.1
dtutil /Fi "C:\MyPackage.dtsx" /EN SQL;TestProject\TestPackage;5 /Q /dests 193.0.0.1
dtutil /FDi SQL;\TestProject /sources 193.0.0.1
pause

This script will create a new folder in the package store called TestProject, install TestPackage to it and then give us a view of the packages in TestProject, so we know it's installed correctly. It'll also display that until the user presses a key. From there our batch script might go on to run an SQL script or install a library. It's all up to you.

No comments

Add Comment

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.
BBCode format allowed