8

I have a PS script that should deploy a project to my SSIS server. When I run the generated command in a console it runs fine but when the command is executed from Powershell it fails because of this (windows) error :

TITLE: SQL Server Integration Services

The path format is invalid. Parameter name: DestinationPath (ISDeploymentWizard)

ADDITIONAL INFORMATION:

The path format is invalid. (Microsoft.SqlServer.IntegrationServices.Wizard.Common)

If I run the generated command from a console it runs fine:

D:\Deploy\ISDeploymentWizard.exe /Silent /ModelType:Project /SourcePath:"D:\Deploy\Receive\My_Beautiful_Project.ispac" /DestinationServer:"localhost" /DestinationPath:"/SSISDB/My Beautiful Project/My_Beautiful_Project" /ProjectPassword:"SuperSecretPassword"

The script (thanks to suggestions from Guenther Schmitz and Janne Tukaanen) :

#region script configuration
$SsisServer = "."
$ProjectFileFolder = "D:\Deploy\Receive"
$ProjectFileName = "My_Beautiful_Project.ispac"
$ProjectFilePassword = "SuperSecretPassword"
$FolderName = "My Beautiful Project"
$ProjectName = "My_Beautiful_Project"
$ISDeploymentWizard = "D:\Deploy\ISDeploymentWizard.exe"
#endregion

#region project deployment
# Create command line arguments
$DestinationPath = "/SSISDB/" + $FolderName + "/" + $ProjectName
$ProjectFilePath = $ProjectFileFolder + "\" + $ProjectFileName
$cmd = $ISDeploymentWizard
$arg1 = "/Silent"
$arg1a= "/ModelType:Project"
$arg2 = "/SourcePath:""$ProjectFilePath"""
$arg3 = "/DestinationServer:""$SsisServer"""
$arg4 = "/DestinationPath:""$DestinationPath"""
$arg5 = "/ProjectPassword:""$ProjectFilePassword"""
Write-Host "$cmd" $arg1 $arg1a $arg2 $arg3 $arg4 $arg5
& "$cmd" $arg1 $arg1a $arg2 $arg3 $arg4 $arg5


Write-Host "Done"
#endregion 
10
  • 2
    Isn't $cmd missing from you execution line? You are trying to run $arg1 now. Commented Nov 29, 2018 at 7:50
  • It was indeed. But now I have a different error :| (see question) Commented Nov 29, 2018 at 9:14
  • replace all the curly 'smart' quotes with straight ones Commented Nov 29, 2018 at 10:04
  • That is formatting due to stackoverflow :| Commented Nov 29, 2018 at 10:09
  • 1
    did you try the pure powershell solution? learn.microsoft.com/en-us/sql/integration-services/… Commented Dec 1, 2018 at 7:42

4 Answers 4

4
+50

There is no need to declare the following variables $arg1 $arg1a $arg2 $arg3 $arg4 $arg5, just run the following command (why declaring variables and storing their values in another variables??):

& $cmd /Silent /ModelType:Project /SourcePath:$ProjectFilePath /DestinationServer:$SsisServer /DestinationPath:$DestinationPath /ProjectPassword:$ProjectFilePassword
Sign up to request clarification or add additional context in comments.

1 Comment

This did it! Now the deploy runs.
2

you are missing the executable in the line below Write-Host.

change

& $arg1 $arg2 $arg3 $arg4 $arg5 

to

& $cmd $arg1 $arg2 $arg3 $arg4 $arg5 

1 Comment

I did that. I also noticed that the string provided when I manually run ISDeploymentWizard has an extra parameter. I added that also. But when I run it now I get a different error (updated question)
1

If you have troubles to start console apps in powershell (typically because of multiple arguments), you may execute it through cmd (in powershell)

cmd /c "$cmd $arg1 $arg2 $arg3 $arg4 $arg5"

There is also another option using Process class, so you don't have to use cmd:

$ProcessInfo = New-Object System.Diagnostics.ProcessStartInfo 
$ProcessInfo.FileName = "D:\Deploy\ISDeploymentWizard.exe"
$ProcessInfo.Arguments = "$arg1 $arg1a $arg2 $arg3 $arg4 $arg5"
$ProcessInfo.RedirectStandardError = $true 
$ProcessInfo.RedirectStandardOutput = $true 
$ProcessInfo.UseShellExecute = $false 
$Process = New-Object System.Diagnostics.Process 
$Process.StartInfo = $ProcessInfo 

$Process.Start() | Out-Null 
$output = $Process.StandardOutput.ReadToEnd() 
$errors = $Process.StandardError.ReadToEnd()
$Process.WaitForExit() 
Write-Host $output 
Write-Error $errors 

You can check this for some more details: PowerShell, stream Process output and errors while running external process

8 Comments

Unfortunately, it still fails on the Destinationpath. I tried a destinationpath without spaces but it gives me the same error. So it seems not to be the content of destinationpath that causes the error.
Strange. Can you just copy a working command from console (without string building). Like cmd /c 'working command here' Also try to use single quotes, sometimes it matters
Also check this link, it uses slightly diffferent approach for that (for PS) stackoverflow.com/questions/21555086/…
Try to remove spaces from destination folder (somebody mentioned that might be an issue). I think you can also save your working cmd command as a bat file, and just call it from powershell (by typing full path to that bat)
Just realized there is another approach for that, updated my answer
|
0

Pretty sure that the $DestinationPath needs to be a non relative path. Change it to the full path including the drive and I think that will solve your problem.

1 Comment

DestinationPath is the destinationpath within the SSIS catalog. I do not think there is a drive involved?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.