Monday, July 30, 2012

DS Query to get a list of all users in a particular Security group in a Windows 2008 R2 Domain

dsget group "CN=testgroup,OU=groups,OU=all groups,DC=contesso,DC=com,DC=au" -members | dsget user -samid -display  -email -disabled > c:\temp\newquery.txt

This query allows you to extract the list of all user accounts with attributes UserId, Displayname , e-mail address and to check the status of the account [enabled/disabled] and write the result to a text file . This will be of help if the extracted list is greater than ~2000 entries.

I will come up with a power shell version soon. 

No comments: