学海无涯

记录我的程序人生...

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  72 随笔 :: 2 文章 :: 69 评论 :: 11 引用

//增加用户
string dom ="LDAP://intdomain.com/CN=Users,DC=intdomain,DC=com";
System.DirectoryServices.DirectoryEntry entry1 = new System.DirectoryServices.DirectoryEntry(dom);

DirectoryEntries myEntries = entry1.Children;
 DirectoryEntry myDirectoryEntry = myEntries.Add("CN=myuser", "user");
  myDirectoryEntry.Properties["givenname"].Value="test";
  myDirectoryEntry.Properties["sn"].Value="htestsn";
  myDirectoryEntry.Properties["displayname"].Value="testdisplayname";   
myDirectoryEntry.Properties["mail"].Value="testmail";
 myDirectoryEntry.CommitChanges();

//设置密码.
myDirectoryEntry.Invoke(“SetPassword“,newPassword);

posted on 2004-09-09 14:02 josson 阅读(481) 评论(0) 编辑 收藏