DirectoryEntry Enabled

I need to check whether an account in the active directory was enabled.

After some searching, I came to understand that the enabled feature is not only for User but for every node in the active directory. That means every DirectoryEntry instance.

Here is how you check if it is enabled

public const string 
AccountControl="userAccountControl"; public const int EnabledFlag= 0x2;
static bool IsEnabled(DirectoryEntry de)
  return (((int)
  & EnabledFlag) == 0;

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s