如何在2000和XP下添加用户

如何在2000和XP下添加用户
A;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);
    }
}

posted on 2004-10-14 16:33  LEE  阅读(1674)  评论(0编辑  收藏  举报

导航