Information about the domain could not be retrieved (1355)

  • Thread starter Thread starter Karbust
  • Start date Start date
K

Karbust

Guest
Hello,

I'm finishing up my program and just today I realized that I can't fetch the group on a domain non-member computer (everything works on a domain member computer) but only if the user is not inside the group, if the user is inside both groups there's no error, otherwise it crashes...

This is the function:

public bool[] IsUserGroupMember(string sUserName, string sGroupName, string sGroupName2)
{
UserPrincipal oUserPrincipal = GetUser(sUserName);
GroupPrincipal oGroupPrincipal = GetGroup(sGroupName);
GroupPrincipal oGroupSecundary = GetGroup(sGroupName2);

if (oUserPrincipal != null && oGroupPrincipal != null && oGroupSecundary != null)
{
return new bool[] {oUserPrincipal.IsMemberOf(oGroupPrincipal), oUserPrincipal.IsMemberOf(oGroupSecundary)};
}

return new bool[] {false};
}



This are the functions required by that function:


public PrincipalContext GetPrincipalContext()
{
PrincipalContext oPrincipalContext = new PrincipalContext(ContextType.Domain, Dominio, stringAD, @Adminlogin, Adminpass);
return oPrincipalContext;
}

public UserPrincipal GetUser(string sUserName)
{
PrincipalContext oPrincipalContext = GetPrincipalContext();

UserPrincipal oUserPrincipal =
UserPrincipal.FindByIdentity(oPrincipalContext, sUserName);
return oUserPrincipal;
}

public GroupPrincipal GetGroup(string sGroupName)
{
PrincipalContext oPrincipalContext = GetPrincipalContext();

GroupPrincipal oGroupPrincipal =
GroupPrincipal.FindByIdentity(oPrincipalContext, sGroupName);
return oGroupPrincipal;
}


A screenshot of the code: https://image.prntscr.com/image/T4Up24Q6ScKMGyGZz1-qjg.png


As I said before, this works on a domain member computer...


I can ping my domain, and I also have the domain poiting out to the machine IP on hosts file.

The machine's firewall is disabled.

I'm using VMware for the Windows Server 2012 R2 machine


Does anyone have any idea?

Continue reading...
 
Back
Top