.NET Active Directory Wrapper

   Access Active Directory From Your Code

View DotNet Active Directory Wrapper Plus Demo
 

Active Directory
Introduction
Objects
Object Properties

DirectoryServices Namespace
Introduction
DirectoryEntry Class

How to .. in C# .NET
Create User
Disable User
Enable User
Authenticate a User
Change User Password
Get DirectoryEntry of a user
Get Users in a Group
Get Object Property

Other Resources
References

Enabling a user in Active Directory

public static void EnableUserAccount(DirectoryEntry oDE)
{
//we enable the account by resetting all the account options excluding the disable flag
// oDE.Properties["userAccountControl"][0]=DotnetAD.ADAccountOptions.UF_NORMAL_ACCOUNT|DotnetAD.ADAccountOptions.UF_DONT_EXPIRE_PASSWD;
// oDE.CommitChanges();
//
// // oDE.Invoke("accountDisabled",new Object[]{"false"});
// oDE.Close();
object ent = oDE.NativeObject;
Type type = ent.GetType();
type.InvokeMember("AccountDisabled", BindingFlags.SetProperty, null, ent, new object[] { false });
oDE.CommitChanges();
oDE.Close();
oDE.Dispose();
}