• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1612
  • Last Modified:

DSQuery command with a not equal to syntax??

I have successfully run a dsquery to find accounts  with a primary group of domain users.  
 Is it possible to run a dsquery to users whos primary group is not equal to a group ID. Thank you
0
ejmeado
Asked:
ejmeado
  • 2
  • 2
1 Solution
 
Mike KlineCommented:
Put a not character (!) in front of the primarygroupid in your query

example  !primarygroupid=512

Thanks

Mike
0
 
ejmeadoAuthor Commented:
Thank you Mike,  I tried the ! it in front of the =, the query ran without an output.  I will test it in the morining.
0
 
Mike KlineCommented:
Do it in front of the primary;  see my screenshot using adfind by Joe Richards  http://www.joeware.net/freetools/tools/adfind/index.htm

I first looked for all accounts who had a primarygroupid of 513   then added the not! and it only returned the account that didn't have 513 as its primary group

513 is Domain Users

Thanks

Mike
primarygroupid.png
0
 
ejmeadoAuthor Commented:
Thank you, that worked a treat.
0

Featured Post

Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now