I want to move a computer object to another OU I am connected to another domain and I always getting an exception of type ComException "A referral was returned from the server"
and the object never move!
try
{
//I get the exception here
computerObject.MoveTo(new DirectoryEntry("LDAP://OU=someOU,OU=parentOU,DC=test,DC=com"));
computerObject.CommitChanges();
}
catch (InvalidOperationException inOp)
{
//log
}
catch (COMException comEx)
{
//log
}
//joinPath.Close();
finally
{
computerObject.Close();
}
for troubleshooting I changed the code a little bit but again it doesn't work.
computerObject.MoveTo(new DirectoryEntry("LDAP://OU=someOU,OU=parentOU,DC=test,DC=com"),
"admin@test.com","somepassowrd",AuthenticationTypes.Secure));
the new exception is of type ComException "Logon failure: unknown user name or bad password."
I checked that there exists an OU in the active directory and I have enough permissions.
I followed Microsoft docs here https://msdn.microsoft.com/en-us/library/ms180856(v=vs.90).aspx and many stackoverflow questions.
Update: I am running my application in one domain and making changes in another domain, it might be the cause of the problem