ドメインとその子ドメインのグループを取得するには、AD にクエリを実行する必要があります。次のコードを実行すると、子ドメイン (例: mydomain.com と child.mydomain.com) のドメイン グループではなく、現在のドメイン グループのみが取得されます。私が欠けているものについて何か考えがありますか?
using(var filter = new GroupPrincipal(new PrincipalContext(ContextType.Domain)))
{
filter.IsSecurityGroup = true;
filter.GroupScope = GroupScope.Global;
using(var searcher = new PrincipalSearcher(filter)
using(var results = searcher.FindAll())
{
//results contains the groups in mydomain.com only
}
}
(行われた呼び出しをより適切に説明するためにコードを更新しました)