Skip to content

Exporting members of an Active Directory group

A while back, my boss came to me, asking me if I could get him an export of the users that are members of two groups in Active Directory. For the purposes of this blog post, let’s call them “OfflineUsers” and “Software Access”. As it turns out, this is pretty easy to do. Here’s how:

    1. Log on to your Domain Controller
    2. Open a command prompt
    3. Enter the command dsquery group -samid %GROUPNAME% | dsget group -members > filename.txt, substituting %GROUPNAME% for the name of the group, and replacing filename with something logical if you so desire:

  • Go to the folder from which you run the command, and grab the text files

A few things to remember here:

  1. You must enclose group names with spaces in quotes, like so: "Software Access"
  2. You can specify what folder to store the file in, like so: > C:%GROUPNAME%.txt

One Comment

Leave a Reply to Exporting a list of a given users group memberships from Active Directory | STFU && RTFM Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.