Im updating ActiveDirectory from an external HR system. This system wil produce True/False values if an account is disabled or not. I noticed (from this great forum) examples of how to combine useraccountcontrols but have a question.
If I do as Marc suggested in a previous post
const int UF_ACCOUNTDISABLE = 0x0002;
const int UF_NORMAL_ACCOUNT = 0x0200;
int userControlFlags = UF_NORMAL_ACCOUNT
newUser.Properties["userAccountControl"].Value = userControlFlags;
And alter the UF_NORMAL .. UF_ACCOUNTDISABLE according to the true/false value, will I not erase whatever other flags there was? Or do I just add another value to whatever were there in the first place? (Guess not all account is simply a matter of disabled/normal)
Regards
Not sure yet if it will work, but I think I might be able to do something like this
int uac = Convert.ToInt32(user.Properties["userAccountControl"][0]);
if (p.Active.Equals("Y"))
uac = uac | ADS_UF_ACCOUNTDISABLE;
else
uac = uac & ~ADS_UF_ACCOUNTDISABLE;