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!
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!