Locked History Actions

HowToProgrammaticallyCreateWindowsAccount

public static void CreateLocalUser(string username, string password, string description)
{
    DirectoryEntry AD = new DirectoryEntry(“WinNT://” + Environment.MachineName + “,computer”);
    DirectoryEntry NewUser = AD.Children.Add(username, “user”);
    NewUser.Invoke(“SetPassword”, new object[] { password });
    NewUser.Invoke(“Put”, new object[] { “Description”, description });
    NewUser.CommitChanges();
}

See also http://support.microsoft.com/kb/306273.


CategoryWindowsProgramming