take a look here: https://msdn.microsoft.com/en-us/library/windows/desktop/ms698810%28v=vs.100%29.aspx
Create user:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.DirectoryServices; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string ADFullPath = "LDAP://192.168.0.10/OU=T2,OU=root,DC=admin,DC=domain,DC=com"; DirectoryEntry ouEntry = new DirectoryEntry(ADFullPath, "admin", "passw0rd", AuthenticationTypes.Secure); for (int i = 0; i < 1; i++) { try { DirectoryEntry childEntry = ouEntry.Children.Add("CN=TESTUSER" + i, "user"); childEntry.CommitChanges(); ouEntry.CommitChanges(); childEntry.Invoke("SetPassword", new object[] { "password22" }); childEntry.CommitChanges(); } catch (Exception ex) { } } } } }
Also check this: http://www.codeproject.com/Articles/18102/Howto-Almost-Everything-In-Active-Directory-via-C