How to print the list of users member of a security group

Discussion in 'Active Directory' started by Deephazz, Dec 8, 2005.

  1. Deephazz

    Deephazz Guest


    I've spent hours trying to find out a way to print a list or to save in a
    txt file the list of the users who are member of a security choosen group in
    my domain.

    Do you know how to do that ?

    for instance I want to retrieve all the user members of the
    DATA_MARKETING_RW in a file that I could print afterwards.

    It seems so obvious this function exists somewhere. I'm feeling stupid not
    to find it.

    Deephazz, Dec 8, 2005
    1. Advertisements

  2. Deephazz

    Todd J Heron Guest

    At a CMD prompt on a domain controller:

    C:\net group "groupname" > "groupname".txt

    If not on a DC, then use the /domain switch, which tells the command that it
    needs to run against a domain controller, not the SAM on the local machine.
    For example:

    C:\net group "groupname" /domain > "groupname".txt

    Creating User and Group Reports in Windows NT

    Or try one of these:

    1) Use Hyena from Double-click on the group name to
    display it's members in the right-hand pane. Then select all the members in
    the right-hand pane by clicking Edit > Select All. Then click Edit > Copy.
    A new dialog will ask you to either copy the contents to memory or to a text

    Note: Hyena offers free support for Hyena to their customers, and to those
    evaluating it. Support is always for free. If you want to download new
    versions you must have current maintenance, though.

    2) Exporter from (Free). Can be
    configured to dump users, groups, group members, shares, services, drives,
    and printers.

    3) Use a tool from Ideal Administration. This tool generates MS Access
    tables of NT 4.0/2000 objects. Use the option "Databases\Groups". For a
    free 30 day version visit: - You can also export:
    network cards, IP addresses, installed software on workstations, etc. This
    can be also generated by using a command line and from scheduled tasks

    Note: Groups in AD are denoted by the memberOf attribute.

    4) You could use VBScript & WMI similar to this one:

    Option Explicit
    Dim intCount, strGroup, strDomain, oGroup, oMember
    strGroup = InputBox("Group to query?")
    strDomain = InputBox("Domain or machine that hosts the group?")
    set oGroup = GetObject("WinNT://" & strDomain & "/" & strGroup & ",group")
    For Each oMember in oGroup.Members
    intCount = intCount + 1
    msgbox "Group: " & strGroup & " hosted by: " & strDomain & " has " &
    intCount & " members"

    Be careful if you're just pasting the above into a script, the last line
    above needs to be all on one line.

    Note: Groups in AD are denoted by the memberof attribute.

    5) Courtesy of Paul Williams:

    C:\>dsget group "CN=GroupName,DC=domain-name,DC=com" -members

    If you need to specify a server and/ or credentials, append the following on
    the end:

    -s dc01 -u userName -p *
    Todd J Heron, Dec 8, 2005
    1. Advertisements

  3. Deephazz

    Deephazz Guest

    Thank you,

    I cannot get the script and the "net group" (not on DC) working :(

    but the "dsget group works" fine. Now i must make a script to get rid of the
    "CN=", "DC=", in my txt file.

    Deephazz, Dec 9, 2005
  4. Deephazz

    Todd J Heron Guest

    Note: The /domain switch is the actual word "domain" do not substitute your
    actual domain name here. You also cannot filter out the "CN=", "DC=" from
    the dsget results you must do that after the fact.
    Todd J Heron, Dec 9, 2005
  5. Deephazz

    Deephazz Guest

    You're right I was replacing the /domain switch by the domain name I'm in.
    This works fine now.
    Thanks a lot for your help.

    Deephazz, Dec 9, 2005
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.