2

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
3

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

4
  • 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: gallery.technet.microsoft.com/scriptcenter/… – 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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