Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I must copy all login names of a specific user group of a windows server to a 3rd party system. To make it easy I need an text list of the login names. I don't like to copy the login names from the user property dialog and build the list by my own.

I think (and hope) their must be a tool on windows server 2003 R2 to do this task.

Thanks in advance

My solution

After hints of duenni I build this batch file which do the job:

@echo off
dsget group "CN=MyUserGroup,OU=MyOU3,OU=MyOU2,OU=MyOU1,DC=MyDC3,DC=MyDC2,DC=MyDC1" -members >users.txt
echo >usernames.txt
for /F "tokens=*" %%i in (users.txt) do dsquery * %%i  -attr sAMAccountName >>usernames.txt
find /V "sAMAccountName" usernames.txt
share|improve this question
up vote 3 down vote accepted

In the MMC "Active Directory Users and Computers" right Click on the OU you want to export goto Action - Export list.

share|improve this answer
Thanks, on this way I get a list of all user groups in an organization unit but not a list of all users in a user group. Do you have any further hints? – Heinz Z. May 19 '11 at 13:05
Ah, ok, members of a specific group. I overlooked this. I don't think you can solve this with the export feature of the MMC. Have a look at dsget and dsquery on the commandline. I think it is possible with this command. – duenni May 19 '11 at 13:34
Also found this:… – duenni May 19 '11 at 14:14
Thanks your information lead me to a solution see my updated question. But I accept your answer because it was the needed hint for me – Heinz Z. May 20 '11 at 10:07
Thanks. Glad it worked. – duenni May 20 '11 at 10:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.