SEARCH

The How-To Geek Forums Have Migrated to Discourse

How-To Geek Forums / Windows 7

(Solved) - AD Query

(3 posts)
  • Started 1 year ago by alexak
  • Latest reply from Drizzle
  • Topic Viewed 276 times

alexak
alexak
Posts: 23

Hi guys,

i need to query the AD to find the group membership for number of users, could you please suggest which command i need to use

now i am using dsquery to get it, but the below command which i am using is needed to edit every time with appropriate group id, where as i need to get all the groups of a given user with single command -- is it possible?

dsquery group -name "group name" | dsget group -members

thank you

Posted 1 year ago
Top
 
alexak
alexak
Posts: 23

Hi,

i got the solution

first we need to get the DN of the user with following command

DSQUERY.exe * -limit 0 -filter "(&(objectCategory=Person)(objectClass=User)(!userAccountControl:1.2.840.113556.1.4.803:=2))" >"User-DN.txt"

then use the DN to get the group membership
dsget user <UserDN> -memberof

thank you,
alex

Posted 1 year ago
Top
 
Drizzle
Drizzle
Posts: 2045

H alexak

Pleased you worked out the info..well done.
Thanks for posting result here for anyone else searching .
Good luck

Posted 1 year ago
Top
 



Topic Closed

This topic has been closed to new replies.

Enter Your Email Here to Get Access for Free:

Go check your email!