Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Information about the domain could not be retrieved (1355)

Here is a sample of my code

var domainContext = new PrincipalContext(ContextType.Domain, "domain_server_ip",  
            "domain_admin_username", "domain_admin_password");
var group = GroupPrincipal.FindByIdentity(domainContext, "mygroup");
var users = group.Members.Where(member => names.Contains(member.Name))
            .ToList();
users.ForEach(u => group.Members.Remove(u));
group.Save(domainContext); // <-- Here I get the error

Same error if I try to get user groups

var user = UserPrincipal.FindByIdentity(domainContext, "username");
var gps = user.GetGroups(domainContext).ToList(); // <-- Here I get the error

I tried using ContextOptions.SimpleBind in connection, but nothing changes.
I've also tried setting a container name in connection, but again nothing changes.

Please note that I'm able to retrieve the group and its members... so I don't understand why I can't save the group or read user groups.

like image 912
Marco Avatar asked Jan 28 '16 15:01

Marco


Video Answer


1 Answers

Try adding the IP address of the domain controller you're querying (in the first line - domain_server_ip) as the first DNS server on your network card's IP settings. (borrowed from here)

like image 143
squillman Avatar answered Sep 26 '22 15:09

squillman