title: Trust Relationship between the Primary Domain and the Trusted Domain exception on SecurityIdentifier.Translate
body: <p>In a script task within SSIS, I am running this block of code</p>
  
  <pre><code>SecurityIdentifier sid = new SecurityIdentifier(memberDN.Substring(0, memberDN.IndexOf(",")).Replace("CN=", ""));
  try
  {
      NTAccount acct = sid. (NTAccount)sid.Translate(typeof(NTAccount));
      LogonName = acct.Value;
  }
  catch (Exception ex)
  {
      Dts.Events.FireError(0, "Example script task", ex.Message + "\n" + ex.StackTrace + "\n Failed MemberDN:" + memberDN, String.Empty, 0);
      Dts.TaskResult = (int)ScriptResults.Failure;
  }
  </code></pre>
  
  <p>This works fine on my local PC in dev environment, but when deployed to the server and run I get this error:</p>
  
  <p>The trust relationship between the primary domain and trusted domain failed at SecurityIdentifier.TranslateToNTAccounts</p>
  
  <p>Failed MemberDN: CN=S-1-5-21-2347892348791324etc.. CN=ForeignSecurityPrincipals,DC=mlol,DC=local</p>
  
  <p>I'm not really sure how to proceed from here, and how to trace this error further. </p>