我找到了下面这段代码,它列出了How to query Active Directory for all groups and group members?中的所有AD组
// create your domain context
PrincipalContext ctx = new PrincipalContext(ContextType.Domain);
// define a "query-by-example" principal - here, we search for a GroupPrincipal
GroupPrincipal qbeGroup = new GroupPrincipal(ctx);
// create your principal searcher passing in the QBE principal
PrincipalSearcher srch = new PrincipalSearcher(qbeGroup);
// find all matches
foreach(var found in srch.FindAll())
{
GroupPrincipal foundGroup = found as GroupPrincipal;
if(foundGroup != null)
{
// do whatever you need to do, e.g. put name into a list of strings or something
}
}我想知道我们是否可以找到列出的组是安全组还是分发组?
发布于 2017-01-26 19:18:53
是。确实存在检查组类型的方法。
https://stackoverflow.com/questions/37466371
复制相似问题