使用C#操作WindowAD之的Windows用户组
程序员文章站
2022-05-13 16:03:37
...
public void CreateWindowsGroup(String groupName, String groupDesc, int groupCtl) { String ladpRootPath = "LDAP://192.168.213.168/CN=Users,DC=pk1,DC=cctv,DC=com"; DirectoryEntry ladpRoot = new DirectoryEntry(ladpRootPath); ladpRoot.Username = "XXXXX"; ladpRoot.Password = "XXXXX"; DirectoryEntry group = ladpRoot.Children.Add("CN=" + groupName, "group"); group.Properties["sAMAccountName"].Value = groupName; group.Properties["description"].Value = groupDesc; group.Properties["groupType"].Value = groupCtl; group.CommitChanges(); group.Close(); }
上一篇: 给个遍历的代码,该如何处理