import ssis packages

In this post, I will explain how to develop a PowerShell script to import multiple SSIS packages. You can use the script straight away to deploy the SSIS packages in any environment. I recommend that you to read all the steps in the script before you start using.

This set of scripts were developed and tested in order to automate SSIS packages migration from one environment to other.
Copy below script into notepad and save it as “Import-SSISPackages.ps1”

[CmdletBinding()] 
Param(
     [Parameter(Mandatory=$true)]
     $SQLInstanceName,
     [Parameter(Mandatory=$true)]
     $PackageDir
)

FUNCTION Import-SSISPackages{
    Param(
        [string]$SQLInstanceName,
        [string]$PackageDir
    )
    $CMD =$('for %I in (*.dtsx) do dtutil /FILE '+[char]34+'%I'+[char]34+' /COPY SQL;'+[char]34+'%~nI'+[char]34+' /DESTSERVER '+ $SQLInstanceName)

    Start-Process CMD -ArgumentList "/k $CMD" -WorkingDirectory "$PackageDir" #-NoNewWindow
}
Import-SSISPackages $SQLInstanceName $PackageDir

Now, you are ready to start importing your ssis packages.
$SQLInstanceName is your destination sql server
$PackageDir is the directory name where all packages located.

Import-SSISPackages.ps1 $SQLInstanceName $PackageDir

Conclusion:
Above script makes it easy for us to not only import our ssis packages to SQL Server but automate the whole process as well.

Published by Jean Joseph

Jean Joseph is a Database, Big Data, Data Warehouse Platform, Data Pipeline, Database Architecture Solutions Provider as well as a Data Engineer enthusiast among other disciplines.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: