SSIS script task SMO call fails when running from Windows 2016 Server (sql server agent) but succeeds when run from Visual Studio or Windows 2012

Ed 41 Reputation points
2023-03-24T15:48:11.8233333+00:00

This SSIS package is part of the scheduled process that worked fine for years. It started failing after we upgraded OS of SSIS SQL Server (application server) from Windows Server 2012 to Windows Server 2016.

Note that this SSIS package (contentious script task, VB) still works fine when run directly from Visual Studio, but again, fails when running the package using sql server agent on application server (where SSIS resides).

This is error message:

Error: 2023-03-23 10:44:02.62

Code: 0x00000001

Source: ScriptTaskName

Description: Exception has been thrown by the target of an invocation.

End Error

SSIS version is SQL Server 2016, service pack 3.

Target .NET framework in the script task (VB) project is 4.0, but I tried to test it with 4.5, 4.6, and 4.7 too, and it did not work.

This is relevant snippet of the script task code:

> Imports System 
> Imports System.Data 
> Imports System.Data.OleDb 
> Imports System.Math 
> Imports Microsoft.SqlServer.Dts.Runtime 
> Imports Microsoft.SqlServer.Management.Smo 
> Imports Microsoft.SqlServer.Management.Common ...... 
> 
> Dim srv As Server 
> Dim connString As String  
> 
> connString = Dts.Connections("ConnMgrName").ConnectionString.ToString 
> 
> Using MyConn As New OleDbConnection(connString)  
> 
> MyConn.Open() 
>  
> 'This is where it fails: 
> srv = New Server(MyConn.DataSource)
> ```
> 
> 
> ` `

Any idea what could be the reason?

Thanks, Ed

SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,703 questions
Developer technologies | Visual Studio | Other
SQL Server | Other
{count} votes

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.