1
SELECT * FROM OpenQuery ( 
  ADSI,  
  'SELECT displayName, telephoneNumber, mail, mobile, facsimileTelephoneNumber 
  FROM  ''LDAP://XXXXX/DC=XXXXX,DC=local'' 
  WHERE objectClass =  ''User'' and memberOf = ''CN=MyGroup,OU=PermissionGroups,OU=IT grupp,OU=Groups,OU=itgroup,DC=XXXX,DC=local''
  ') AS tblADSI
ORDER BY displayname

This call should give me 12 users, but only gives me 6. Now I was scratching my head trying to find out why, when I noticed the 6 users I did not get, had this 'itgroup' set as primary Group. The second I pick another Group as primary Group I get them back using this call.

Why is that? That's a problem, what can I do about it? And should it even be like this?

Nisse Engström
  • 208
  • 2
  • 5
P3nnyw1se
  • 39
  • 1

1 Answers1

0

Most group memberships are refleted in the memberOf attribute that your query is leveraging. However the primary group is stored in the primaryGroupID attribute. Unless you're using POSIX, you do not need to change the Primary Group from the default of Domain users.

https://technet.microsoft.com/en-us/library/cc771489(v=ws.11).aspx

The user's primary group applies only to users who log on to the network through Services for Macintosh or who run Portable Operating System Interface for UNIX (POSIX)–compliant applications. Unless you are using these services, there is no need to change the primary group from Domain Users, which is the default value.

Clayton
  • 4,483
  • 16
  • 24