Using C# to operate Windows user groups in WindowAD

巴扎黑
Release: 2016-12-19 17:34:37
Original
1470 people have browsed it

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();
}
Copy after login

Related labels:
c#
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template