Book Image

SQL Server 2014 with PowerShell v5 Cookbook

By : Donabel Santos
Book Image

SQL Server 2014 with PowerShell v5 Cookbook

By: Donabel Santos

Overview of this book

Table of Contents (21 chapters)
SQL Server 2014 with PowerShell v5 Cookbook
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Deploying an SSIS package to the package store


In this recipe, we will deploy an SSIS package (.dtsx) to the SSIS package store.

Getting ready

In this recipe, we will use a Customer Package.dtsx package saved in C:\SSIS and deploy this to our SSIS instance. The package will be saved in the \File System\QueryWorks package folder.

To follow this recipe, use a .dtsx package that is readily available in your environment and decide where you want it deployed.

How to do it...

Let's explore the code required to deploy an SSIS .dtsx file:

  1. Open PowerShell ISE as an administrator.

  2. Add the ManagedDTS assembly as follows:

    #add ManagedDTS assembly
    Add-Type -AssemblyName "Microsoft.SqlServer.ManagedDTS, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"
  3. Add the following script and run it:

    $server = "localhost"
    
    #create new app
    $app = New-Object "Microsoft.SqlServer.Dts.Runtime.Application"
    
    #specify package to be deployed
    $dtsx = "C:\SSIS\Customer Package.dtsx"
    $package = $app.LoadPackage($dtsx...