I have a bit of code that binds to on Active Directory user, disable it, and move it to a cleanup OU. I tried to add a line of code that will write to the description attriubute on the object, but I keep getting the error "c# index was out of range. Must be nonnegative and less than the size of the collection", once the code reaches userMove.Properties["descr
Below is a snipped of the code"
AccDisable ad = new AccDisable();
// Bind to the object to be moved.
DirectoryEntry userMove = new DirectoryEntry("LDAP://" + userDN, systemUser, systemPw);
// Update the Description attribute on the user
userMove.Properties["description"] = "no NASW Authentication has taken place in the past" + dayCreatRound;
// Use the MoveTo property to define the new container you want to move the object to.
// userMove.MoveTo(new DirectoryEntry("LDAP://OU=OVER_45_DAYS_USER,OU=CLEANUP,OU=domain.com", systemUser, systemPw));
catch (InvalidOperationException InvOpEx)
// Handle InvalidOperationException.
string messageEx = "Could not move "+InvOpEx.Message;
catch ( Exception Ex)
// Handle all other errors
string messageEx = "Could not move " + Ex.Message;