title: Error While executing a SSIS package which contains a script task through SQL Server Agent job
body: <p>I have a <code>SQL Server 2012</code> SSIS package with a script task along with other tasks [data flow, execute sql tasks ]. When I manually executed the job its completed successfully.</p>
  <p>But when I executed the package through <code>SQL Job Agent</code>, it is getting failed with the below error message.</p>
  <blockquote>
  <p>&quot;Error: 2014-05-13 12:45:14.67</p>
  <p>Code: 0x00000001</p>
  <p>Source: Script Task</p>
  <p>Description: Exception has been thrown by the target of an invocation.</p>
  <p>End Error</p>
  <p>DTExec: The package execution returned DTSER_FAILURE (1).</p>
  <p>Started:  12:45:10 PM</p>
  <p>Finished: 12:45:14 PM</p>
  <p>Elapsed:  4.353 seconds&quot;</p>
  </blockquote>
  <p>My <code>Script Task</code> is for load data in Text File and add to variable</p>
  <pre><code>public void Main()
      {
          // TODO: Add your code here
          StreamReader sr = new StreamReader(&quot;E:\\IEREVISIPDKE\\IELOADING.txt&quot;);
  
          string st = sr.ReadToEnd();
          this.Dts.Variables[&quot;IE&quot;].Value = st;
  
          //MessageBox.Show(st);
  
          Dts.TaskResult = (int)ScriptResults.Success;
  </code></pre>
  <p>Thanks,</p>