Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Active Directory/SID Help

Status
Not open for further replies.

andegre

MIS
Oct 20, 2005
275
US
Hi All

I have inherited a program that I am trying to get running that is going to sync my active directory structure from one domain to another, but I'm getting hung-up on one part when trying to do an NTAccount.Translate method...

FYI - Most of this program is over my head so...

Here's the code snippet that is failing for me:

NTAccount acct = new NTAccount(accountName);
SecurityIdentifier sid = null;
if (acct.IsValidTargetType(typeof(SecurityIdentifier)))
{
sid = (SecurityIdentifier)acct.Translate(typeof(SecurityIdentifier));
if (sid.IsAccountSid() && sid.AccountDomainSid != domainSid)
{
sid = null;
}
}

This throws the error:
'Some or all identity references could not be translated'

Here is the stacktrace:
" at System.Security.Principal.NTAccount.Translate(IdentityReferenceCollection sourceAccounts, Type targetType, Boolean forceSuccess)\r\n at System.Security.Principal.NTAccount.Translate(Type targetType)\r\n at ADSync.SidResolver.GetSidBySamAccount(String accountName) in C:\\Vault\\Utilities\\ADSyncConsole\\ADSync\\SidResolver.cs:line 152"

Any help will be much appreciated!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top