Open mwilliamson1975 opened 6 months ago
I did a little more digging after initially opening this ticket. It appears that the command fails when setting the first parameter value in the Invoke-PorjectDeployment function. The error reported is:
"Cannot convert argument "sqlDbType", with value: "MyFolder01", for "Add" to type "System.Data.SqlDbType": "Cannot convert value "MyFolder01" to type "System.Data.SqlDbType"
This occurs on line 155 and I believe that it expects a data type instead of the folder name, then the parameter can be subsequently set. Instead of:
$cmd.Parameters.Add("@folder_name", $Folder) | Out-Null
it should be:
$cmd.Parameters.Add("@folder_name", [Data.SQLDBType]::NVarChar, 128).Value = $Folder
or:
$cmd.Parameters.AddWithValue("@folder_name", $Folder);
Likewise for the following line using the project variable.
If I can find the time to fork and test this out, then I'll submit a PR.
Updating the parameter strings fixed the initial issue. There is a subsequent error that arises in from Invoke-ProjectDeployment on line 162:
Method not found: 'System.Data.SqlClient.SqlConnection Microsoft.SqlServer.Management.Common.ConnectionManager.get_SqlConnectionObject()'
I receive this same error on multiple machines, and it occurs when running the canned scripts that Microsoft has supplied as examples for DeployProject as well (https://learn.microsoft.com/en-us/sql/integration-services/ssis-quickstart-deploy-powershell?view=sql-server-ver16).
Verified issue does not already exist?
I have searched and found no existing issue
What error did you receive?
I am receiving this when running against multiple source/destination servers ranging in version from SQL 2014 through SQL 2022 Developer and Enterprise editions:
Steps to Reproduce
I have tried:
Please confirm that you are running the most recent version of dbatools
2.1.6
Other details or mentions
No response
What PowerShell host was used when producing this error
Windows PowerShell (powershell.exe), Windows PowerShell ISE (powershell_ise.exe)
PowerShell Host Version
SQL Server Edition and Build number
In the verbose output from above, I used:
.NET Framework Version
.NET Framework 4.8.4645.0