http://www.c-sharpcorner.com/DirectoryServices.asp

解决方案 »

  1.   

    private void AddUser(string strDoamin, string strLogin, string strPwd)
    {
        DirectoryEntry obDirEntry = null;
        try
        {
            obDirEntry = new DirectoryEntry("WinNT://" + strDoamin);
            DirectoryEntries entries = obDirEntry.Children;
            DirectoryEntry obUser = entries.Add(strLogin, "User");
            obUser.Properties["FullName"].Add("Amigo");
            object obRet = obUser.Invoke("SetPassword", strPwd);
            obUser.CommitChanges();
        }
        catch (Exception ex)
        {
            Trace.Warn(ex.Message);
        }
    }
      

  2.   

    you look:
    http://www.c-sharpcorner.com/Code/2003/April/ListingADUsers.asp
      

  3.   

    http://www.c-sharpcorner.com/Code/2002/Aug/AddContactsToAD.asp