Monday, July 19, 2010

Get the List of users in an AD group

1.       First get the AD path of the object you are trying to the members:

dsquery * -filter (cn=WWAPP-A-CPAAZDashboard)

You can even do like this: dsquery * -filter (userPrincipalName=user123*) or dsquery * -filter (cn=computername)

 

2.       Use the dsget and pass in the path:

dsget group "CN=WWAPP-A-CPAAZDashboard,OU=Groups,OU=WWCRO,OU=WorldWide,DC= companyname,DC=net" -members

3.       Now you can pipe the result of this command to another dsget to get the other AD attributes; Final command:

dsget group "CN=WWAPP-A-CPAAZDashboard,OU=Groups,OU=WWCRO,OU=WorldWide,DC=companyname,DC=net" -members | dsget user -samid –display

 **********************  IMPORTANT--PLEASE READ  ************************ This electronic message, including its attachments, is COMPANY CONFIDENTIAL and may contain PROPRIETARY or LEGALLY PRIVILEGED information.  If you are  not the intended recipient, you are hereby notified that any use, disclosure, copying, or distribution of this message or any of the information included in it is unauthorized and strictly prohibited.  If you have received this message in error, please immediately notify the sender by reply e-mail and permanently delete this message and its attachments, along with any copies thereof. Thank you.  ************************************************************************  

No comments:

Post a Comment