How to find out AD User is active or not

UserAccountControl is the property will hold the status of user in AD with that we can able to mask 0x0002 and find out the disabled status.

C# Code
int flags = (int)result.Properties[“userAccountControl”][0];
var IsActive = !Convert.ToBoolean(flags & 0x0002); // If flags & 0x0002 => true Status is Active

Leave a Reply