User Account Control BitMask Constants for C#
I thought the following may be helpful for any C# endeavour with the manipulation of the userAccountControl attribute of an Active Directory User object.
You can use Microsoft Identity Integration Server to provision a user based on certain events. By specifying a userAccountControl value during the creation of an AD user, you can set certain attributes of the user account such as ‘Smartcard Required’ and ‘Do not expire password’.
The userAccountControl value is of type LONG. It acts as a bitmask. You assign it in the following manner (OR-ing the constants):
userAccountControlValue = DONT_EXPIRE_PASSWORD | NORMAL_ACCOUNT;
Bitmask values:
#region userAccountControl Constants
const long SCRIPT = 0×0001;
const long ACCOUNTDISABLE = 0×0002;
const long HOMEDIR_REQUIRED = 0×0008;
const long LOCKOUT = 0×0010;
const long PASSWD_NOTREQD = 0×0020;
const long PASSWD_CANT_CHANGE = 0×0040;
const long ENCRYPTED_TEXT_PWD_ALLOWED = 0×0080;
const long TEMP_DUPLICATE_ACCOUNT = 0×0100;
const long NORMAL_ACCOUNT = 0×0200;
const long INTERDOMAIN_TRUST_ACCOUNT = 0×0800;
const long WORKSTATION_TRUST_ACCOUNT = 0×1000;
const long SERVER_TRUST_ACCOUNT = 0×2000;
const long DONT_EXPIRE_PASSWORD = 0×10000;
const long MNS_LOGON_ACCOUNT = 0×20000;
const long SMARTCARD_REQUIRED = 0×40000;
const long TRUSTED_FOR_DELEGATION = 0×80000;
const long NOT_DELEGATED = 0×100000;
const long USE_DES_KEY_ONLY = 0×200000;
const long DONT_REQ_PREAUTH = 0×400000;
const long PASSWORD_EXPIRED = 0×800000;
const long TRUSTED_TO_AUTH_FOR_DELEGATION = 0×1000000;
#endregion
More information can be found here:
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q305144