Edit SSIS package using powershell

Padmanabhan, Venkatesh 241 Reputation points
2021-04-08T12:21:59.247+00:00

Hi.
I have around 200 SSIS packages, in which I want to make few edits.

I am trying to check if Powershell can solve this issue. I have a specific location in which all my SSIS packages are kept. In each of the SSIS package, there is a GetConnection method. Inside the method , I want to find the first instance of the text GetConnection = strConnection , and add another connection string property before it and save the file.

This process should be repeated for all the files. How to achieve this in Powershell ?
Thanks

SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,457 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,381 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Olaf Helper 40,901 Reputation points
    2021-04-09T08:39:29.367+00:00

    SSIS packages are XML files and PowerShell have a good support to handle & modify XML files.
    See for example https://stackoverflow.com/questions/16428559/powershell-script-to-update-xml-file-content


  2. Ian Xue (Shanghai Wicresoft Co., Ltd.) 29,891 Reputation points Microsoft Vendor
    2021-04-12T05:13:12.483+00:00

    Hi,

    You can match text with a regular expression. Please refer to this link for more details.
    https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_regular_expressions

    Best Regards,
    Ian Xue

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments