Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Script Task Error

Script Task Error

Script Task Error

Can anyone help me solve the issue below?

I can run my SSIS package in the IDE on my desktop successfully. Also, I can run my package successfully from DOS using a .BAT file that calls the package on the same computer. However, when I try to run the package on other servers I get the following error when the Script Task is executed:

Failed to load task "Script Task", type Microsoft.SQLserver.Tasks.ScriptTask.ScriptTask, Version=, Culture=neutral, PublicKeyToken=89845dcd8080cc91", The contact information for this task is "".

The C# code for the script task is as follows:

using System;

using System.Data;

using System.Collections.Generic;

using Microsoft.SqlServer.Dts.Runtime;

//using Microsoft.SqlServer.ManagedDts;

using System.Windows.Forms;

namespace ST_2505d5a050044f9e975ce7dc4828ddd8.csproj


[System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]

public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase


#region VSTA generated code

enum ScriptResults


Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,

Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure




The execution engine calls this method when the task executes.

To access the object model, use the Dts property. Connections, variables, events,

and logging features are available as members of the Dts property as shown in the following examples.

To reference a variable, call Dts.Variables["MyCaseSensitiveVariableName"].Value;

To post a log entry, call Dts.Log("This is my log text", 999, null);

To fire an event, call Dts.Events.FireInformation(99, "test", "hit the help message", "", 0, true);

To use the connections collection use something like the following:

ConnectionManager cm = Dts.Connections.Add("OLEDB");

cm.ConnectionString = "Data Source=localhost;Initial Catalog=AdventureWorks;Provider=SQLNCLI10;Integrated Security=SSPI;Auto Translate=False;";

Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.

To open Help, press F1.


public void Main()


string returnVal = "";

string result = "";

string data = Dts.Variables["User::gs_encrypted_pwd"].Value.ToString();



System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding();

System.Text.Decoder utf8Decode = encoder.GetDecoder();

byte[] todecode_byte = Convert.FromBase64String(data);

int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length);

char[] decoded_char = new char[charCount];

utf8Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0);

result = new String(decoded_char);

returnVal = cleanStrangChar(result.Trim());

Dts.Variables["User::gs_Password"].Value = returnVal;


catch (Exception ex)


returnVal = "ERROR: " + ex.Message.ToString();


Dts.TaskResult = (int)ScriptResults.Success;


public string cleanStrangChar(string strVal)


string returnVal = "";

char singleChar;

for (int i = 0; i < strVal.Length; i++)


singleChar = Convert.ToChar(strVal.Substring(i, 1));

if (!char.IsControl(singleChar))

returnVal += strVal.Substring(i, 1);


return returnVal;




Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close