How to use SSISDeploy command in powershell script

I’m running SSISDeploy command (documentation is here) in my CMD :

SSISDeploy.exe -s:"download\Integration Services.ispac" -d:catalog;/SSISDB/TEST/DEVOPS;"TEST03,1234" -at:win

all working good, and now I need to run it thought powershell script (against windows server 2019 slave), so I tried this syntax:

$SSISDeploy = Start-Process -FilePath SSISDeploy.exe -ArgumentList '/source:"download\Integration Services.ispac"',"/destination:catalog;${Target};"${Env}"" -at:win -wait -PassThru -Credential $cred -RedirectStandardOutput ssisstdout.txt -RedirectStandardError ssisstderr.txt

but it fails with exception:

Start-Process : A positional parameter cannot be found that accepts argument 'TEST03,1234'.
+ ... SISDeploy = Start-Process -FilePath SSISDeploy.exe -ArgumentList '/so ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Start-Process], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.StartProcessCommand

Can you suggest what’s wrong with the syntax?

Why do you use in PowerShell another syntax than in CMD? The error message you posted does not fit to the code you posted!? :wink:
If the command line works in CMD I’d go with the same in PowerShell. And to have it a little easier to read I’d be using splatting:

$StartProcessProps = @{
    FilePath               = 'SSISDeploy.exe'
    ArgumentList           = '-s:"download\Integration Services.ispac" -d:catalog;/SSISDB/TEST/DEVOPS;"TEST03.restest.bank,1234" -at:win'
    Wait                   = $true
    PassThru               = $true
    Credential             = $cred
    RedirectStandardOutput = 'ssisstdout.txt'
    RedirectStandardError  = 'ssisstderr.txt'
}
$SSISDeploy = Start-Process @StartProcessProps
1 Like

Ok tnx. got it. So I have another question on top of it. assuming now the ArgumentList look like that:

ArgumentList = '-s:"download\Integration Services.ispac" -d:catalog;${Target};${Env} -at:win'

How do I fix to make it work? as currently it throws me:

The format of the destination path to the SSIS catalog is invalid. Correct format should be "/SSISDB/<folderName>/[<projectName>]".

When you want to post code you click on the “preformatted text” button first and then you paste the code where it’s shown to you. :wink: That prevents unwanted line breaks.

You can use the format operator like this:

ArgumentList = '-s:"download\Integration Services.ispac" -d:catalog;{0};{1} -at:win' -f $Target, $Env

Is there a special reason why you write your variables in that unusual way?

Hi, I tried it but got this exception:

A null key is not allowed in a hash literal.

  • $ArgumentList = '-s:"download\Integration Services.ispac" -d:cata ...
    

Ooops … typo … sorry. :wink: I corrected my code suggestion above . I accidently added a $ sign in front of ArgumentList. You have to remove that.

Awsome! it works. tnx a lot for your help