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

Posted

in

, ,

by

Comments

One response to “Exporting members of an Active Directory group”

  1. Exporting a list of a given users group memberships from Active Directory | STFU && RTFM

    […] while back, I showed you how to export a list of all members of a group, as well as all computers, from Active Directory. On a related note, here’s how to export all […]

By posting a comment, you consent to our collecting the information you enter. See privacy policy for more information.

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