Use C# to operate WindowAD to add objects to user groups

巴扎黑
Release: 2016-12-19 17:33:02
Original
1593 people have browsed it

Suppose there is a user zhangsan located at LADP://192.168.213.168/CN=zhangsan,CN=Users,DC=pk1,DC=cctv,DC=com. Now we want to add this user to LADP:// In the user group 192.168.213.168/CN=PG_GROUP,OU=ORG_PGM,DC=pk1,DC=cctv,DC=com, the

code is as follows:

C# code

String groupPath = "LADP://192.168.213.168/CN=zhangsan,CN=Users,DC=pk1,DC=cctv,DC=com";  
DirectoryEntry group = new DirectoryEntry(groupPath );  
String userPath = "CN=zhangsan,CN=Users,DC=pk1,DC=cctv,DC=com";  
group.Properties["member"].Add(userPath );  
group.CommitChanges();
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