Results 1 to 3 of 3

Thread: Multiple Group Query

  1. #1
    Join Date
    May 2010
    Posts
    2

    Multiple Group Query

    Hello,

    I am using Exchange 2007. I am looking to perform a search in Active Directory for users who are not in specific groups. Is there a way to perform this search with multiple groups in 1 search to see who is not in these groups? Ive been searching the net but haven't really found an answer.

    Thanks in advance

  2. #2
    Join Date
    Nov 2005
    Posts
    1,323

    Re: Multiple Group Query

    I think yes, you will need to know the distinguihed names for both groups, then you will have to construct a filter like this:

    (&(!(memberOf=CN=Group 1,OU=somewhere,DC=domain,DC=com))(!(memberOf=CN=Group 2,OU=somewhere,DC=domain,DC=com)))

    You wont have to use the LDAP filter, you may select to use an OPath Filter with Get-User:

    Get-User -Filter { -Not (memberOfGroup -eq "CN=Group 1,OU=somewhere,DC=domain,DC=com") -And -Not (memberOfGroup - eq "CN=Group 2,OU=somewhere,DC=domain,DC=com") }

  3. #3
    Join Date
    May 2010
    Posts
    2

    Re: Multiple Group Query

    ok ive never used the opath filter and its been a while since ive done a ldap search but this is what i entered:

    (&(!(memberOf=CN=US HSI UR ISA-FULL,OU=US HSI Groups,DC=us,DC=hsi,DC=local))(!(memberOf=CN=US HSI UR ISA-TSX Only,OU=US HSI Groups,DC=us,DC=hsi,DC=local)))

    it gave me results but not quite what i wanted. it didnt give me users. also i need to perform a search through all our users and who ever is not in 8 specific groups is what i need to see. so ideally id like to do a search through all 8 groups at once and have it show me everyone who is NOT in those groups.

    thanks for your help.

Similar Threads

  1. LDAP Query for memeber of one group
    By vop in forum Active Directory
    Replies: 4
    Last Post: 27-11-2009, 11:15 PM
  2. Need to have multiple where queries in MySQL query
    By Anti_Trend in forum Software Development
    Replies: 1
    Last Post: 03-07-2009, 10:17 PM
  3. need LDAP query to capture nested group ?
    By vivekmohan in forum Active Directory
    Replies: 4
    Last Post: 25-06-2009, 12:10 AM
  4. cannot query for the list of Group Policy objects
    By Joe Nocella in forum Windows Server Help
    Replies: 2
    Last Post: 15-05-2008, 06:24 PM
  5. ldap query for group members
    By Billie in forum Active Directory
    Replies: 1
    Last Post: 23-02-2008, 07:11 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,270,941.02087 seconds with 17 queries