In this recipe, we will execute an SSIS package using PowerShell.
In this recipe, we will execute the Customer Package
, which is saved in the package store, and we will also execute the C:\SSIS\SamplePackage.dtsx
file directly from the filesystem.
Alternatively, you can locate an available SSIS package in your system that you want to execute instead. Identify whether this package is stored in the filesystem or in the SSIS package store.
Let's explore the code required to execute an SSIS package programmatically using PowerShell:
Open PowerShell ISE as an administrator.
Add the
ManagedDTS
assembly as follows:#add ManagedDTS assembly Add-Type -AssemblyName "Microsoft.SqlServer.ManagedDTS, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"
Add the following script and run it:
$server = "localhost" #create new app we'll use for SSIS $app = New-Object "Microsoft.SqlServer.Dts.Runtime.Application...