Powershell to run SSIS package using dtexec set parameters

Sivasankar Rebba 51 Reputation points
2023-03-13T20:42:30.2966667+00:00

I am facing issue in set parameters as my parameter has space. hoe to resolve this.

dtexec '/FILE D:\abc.dtsx /SET "\Package.Variables[User::OracleSource].Properties[Value]";"Data Source=123"

getting error Option "Source=123" is not valid.

it is not condering "Data Source=123" as value of parameter. How to resolve this?

Thanks,

Siva.

SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,664 questions
0 comments No comments
{count} votes

Accepted answer
  1. ZoeHui-MSFT 41,291 Reputation points
    2023-03-14T06:09:20.53+00:00

    Hi @Sivasankar Rebba ,

    I'm not familiar with PowerShell, here is a same thread you may take a reference to.

    Someone also give a sample like shown below.

    "C:\Program Files\Microsoft SQL Server\130\DTS\Binn\DTExec.exe" 
     /project "E:\...\bin\Development\Packages.ispac" 
     /package "Package1.dtsx" 
     /SET \Package.Variables[$Project::Target_ConnectionString];\""Data Source=MyServer\InstanceName;Initial Catalog=My_New_DB_Name;Provider=SQLNCLI11.1;Integrated Security=SSPI;Auto Translate=False;"\"
    

    Regards,

    Zoe Hui


    If the answer is helpful, please click "Accept Answer" and upvote it.


2 additional answers

Sort by: Most helpful
  1. Michael Taylor 57,216 Reputation points
    2023-03-13T21:43:46.36+00:00

    I don't think your syntax is correct. You have a single quote before the argument list but none to finish it. Also inside your SET you are wrapping the variable name in quotes and the value in quotes. You should either wrap the entire string in quotes or use none at all.

    dtexec '/FILE D:\abc.dtsx /SET \Package.Variables[User:OracleSource].Properties[Value];"Data SOurce=123" '
    

    I'm not sure about your Properties["Value"] piece though.

    0 comments No comments

  2. Sivasankar Rebba 51 Reputation points
    2023-03-13T22:26:52.31+00:00

    Sorry I missed part of my code.

    here is my sample code.

    $databaseConnection="Data Source=123"

    $dtsxPath="D:\abc.dtsx"

    $cmd="/FILE $dtsxPath /SET \Package.Variables[User:OracleSource].Properties[Value];$databaseConnection "

    dtexec $cmd

    getting error Option "Source=123" is not valid.

    it is not condering "Data Source=123" as value of parameter. How to resolve this?


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.