J'essaie d'obtenir des informations (membres de groupes).Active Directory - comportement bizarre
Je reçois chaque fois que le message « Informations sur le domaine n'a pas pu être récupéré (1355) »
Pour obtenir les groupes, il a aidé à essayer seulement 2 fois. La première fois ne fonctionne pas, mais la deuxième fois m'apporte les groupes. Mais pour obtenir les membres d'un groupe, je n'ai pas de travail.
PrincipalContext ctx = new PrincipalContext(ContextType.Domain, "192.168.178.105:3268", "DC=ibcdev,DC=local", ContextOptions.Negotiate, "Administrator", "123");
// 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
try
{
var re2s = srch.FindAll().ToList();
}
catch (Exception)
{
}
var res = srch.FindAll();
foreach (Principal found in res)
{
Console.WriteLine(found.SamAccountName);
var group = GroupPrincipal.FindByIdentity(ctx, found.Name);
foreach (var user in group.Members)
{
Console.WriteLine(user.SamAccountName);
}
}
Est-ce que quelqu'un sait ce que je fais mal?
Cordialement
Merci, je vais essayer. – float